-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: image service integrated with feature flag #2003
base: develop
Are you sure you want to change the base?
Conversation
…-Squad/website-backend into feat/image-service-live
@@ -60,7 +60,8 @@ | |||
userValidator.validateImageVerificationQuery, | |||
users.verifyUserImage | |||
); | |||
router.get("/picture/:id", authenticate, authorizeRoles([SUPERUSER]), users.getUserImageForVerification); | |||
router.get("/picture/all", authenticate, authorizeRoles([SUPERUSER]), users.getAllUsersPhotoVerificationRequests); |
Check failure
Code scanning / CodeQL
Missing rate limiting High
authorization
This route handler performs
authorization
This route handler performs
authorization
router.patch( | ||
"/avatar/verify/:id", | ||
authenticate, | ||
authorizeRoles([SUPERUSER]), | ||
checkIsVerifiedDiscord, | ||
updateDiscordImageForVerification | ||
); | ||
router.patch( | ||
"/avatar/update/:discordId", | ||
authenticate, |
Check failure
Code scanning / CodeQL
Missing rate limiting High
authorization
This route handler performs
authorization
This route handler performs
authorization
7818242
to
ec1480f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test case stats missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too long PR
* @return {Promise<{Object}|{Object}>} | ||
* @throws {Error} - If error occurs while fetching user's image verification entry | ||
*/ | ||
const getAllUsersPhotoVerificationRequests = async (username = null) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any confusion or problem this may cause?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So when I read the the function name, what i understand is get all users photo verification requests, is it doing the same?
…-Squad/website-backend into feat/image-service-live
models/users.js
Outdated
url: profileImageUrl, | ||
publicId: profileImageID, | ||
approved: false, | ||
date: admin.firestore.Timestamp.fromDate(new Date()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets not use this formate, lets change it to the standard one which we are following at other place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
models/users.js
Outdated
url: profileImageUrl, | ||
publicId: profileImageID, | ||
approved: false, | ||
date: admin.firestore.Timestamp.fromDate(new Date()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is date here?
Did you mean createdAt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, this was already present there, therefore I opted for using the current ones only. But I can make the change to createdAt, as that will make more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, I'll rather use updatedAt
as the one single picture entry in the photo-verification object can be updated.
await documentRef.update({ status: photoVerificationRequestStatus.APPROVED }); | ||
await updateUserPicture( | ||
{ url: photoVerificationObject.profile.url, publicId: photoVerificationObject.profile.publicId }, | ||
userId | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do both the call needs to happen in a series?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, first the photo-verification-object
needs to be updated, then the user picture needs to be updated too.
const verificationImagesSnapshotQuery = photoVerificationModel.where( | ||
"status", | ||
"==", | ||
photoVerificationRequestStatus.PENDING | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: why not declare/initialize it near to the line where its used?
}); | ||
|
||
const photoVerificationObject = await Promise.all(photoVerificationPromises); | ||
return photoVerificationObject; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are results being paginated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no for now the results are not paginated, but I can add this into in optimization ticket, wdyt?
routes/discordactions.js
Outdated
router.patch( | ||
"/avatar/verify/:id", | ||
authenticate, | ||
authorizeRoles([SUPERUSER]), | ||
checkIsVerifiedDiscord, | ||
updateDiscordImageForVerification | ||
); | ||
// here "id" is the user's discord id | ||
router.patch( | ||
"/avatar/photo-verification-update/:id", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it following route naming conventions?
Date: 13/04/2024
Developer Name: Vinayak Goyal
Issue Ticket Number
closes #1924
Description
Test Coverage