@@ -14,12 +14,13 @@ const { Services } = require("../constants/bot");
1414const authenticateProfile = require ( "../middlewares/authenticateProfile" ) ;
1515const { devFlagMiddleware } = require ( "../middlewares/devFlag" ) ;
1616const { userAuthorization } = require ( "../middlewares/userAuthorization" ) ;
17+ const conditionalMiddleware = require ( "../middlewares/conditionalMiddleware" ) ;
1718
1819router . post ( "/" , authorizeAndAuthenticate ( [ ROLES . SUPERUSER ] , [ Services . CRON_JOB_HANDLER ] ) , users . markUnverified ) ;
1920router . post ( "/update-in-discord" , authenticate , authorizeRoles ( [ SUPERUSER ] ) , users . setInDiscordScript ) ;
2021router . post ( "/verify" , authenticate , users . verifyUser ) ;
2122router . get ( "/userId/:userId" , users . getUserById ) ;
22- router . patch ( "/self" , authenticate , userValidator . updateUser , users . updateSelf ) ;
23+ router . patch ( "/self" , authenticate , userValidator . updateUser , users . updateSelf ) ; // this route is being deprecated soon, please use alternate available `/users/:userId?profile=true` PATCH endpoint.
2324router . get ( "/" , authenticateProfile ( authenticate ) , userValidator . getUsers , users . getUsers ) ;
2425router . get ( "/self" , authenticate , users . getSelfDetails ) ;
2526router . get ( "/isDeveloper" , authenticate , users . isDeveloper ) ;
@@ -75,7 +76,7 @@ router.patch(
7576router . get ( "/picture/:id" , authenticate , authorizeRoles ( [ SUPERUSER ] ) , users . getUserImageForVerification ) ;
7677router . patch ( "/profileURL" , authenticate , userValidator . updateProfileURL , users . profileURL ) ;
7778router . patch ( "/rejectDiff" , authenticate , authorizeRoles ( [ SUPERUSER ] ) , users . rejectProfileDiff ) ;
78- router . patch ( "/:userId" , authenticate , authorizeRoles ( [ SUPERUSER ] ) , users . updateUser ) ;
79+ router . patch ( "/:userId" , authenticate , conditionalMiddleware ( userValidator . updateUser ) , users . updateProfile ) ;
7980router . get ( "/suggestedUsers/:skillId" , authenticate , authorizeRoles ( [ SUPERUSER ] ) , users . getSuggestedUsers ) ;
8081module . exports = router ;
8182router . post ( "/batch-username-update" , authenticate , authorizeRoles ( [ SUPERUSER ] ) , users . updateUsernames ) ;
0 commit comments