@@ -14,12 +14,13 @@ const { Services } = require("../constants/bot");
14
14
const authenticateProfile = require ( "../middlewares/authenticateProfile" ) ;
15
15
const { devFlagMiddleware } = require ( "../middlewares/devFlag" ) ;
16
16
const { userAuthorization } = require ( "../middlewares/userAuthorization" ) ;
17
+ const conditionalMiddleware = require ( "../middlewares/conditionalMiddleware" ) ;
17
18
18
19
router . post ( "/" , authorizeAndAuthenticate ( [ ROLES . SUPERUSER ] , [ Services . CRON_JOB_HANDLER ] ) , users . markUnverified ) ;
19
20
router . post ( "/update-in-discord" , authenticate , authorizeRoles ( [ SUPERUSER ] ) , users . setInDiscordScript ) ;
20
21
router . post ( "/verify" , authenticate , users . verifyUser ) ;
21
22
router . 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.
23
24
router . get ( "/" , authenticateProfile ( authenticate ) , userValidator . getUsers , users . getUsers ) ;
24
25
router . get ( "/self" , authenticate , users . getSelfDetails ) ;
25
26
router . get ( "/isDeveloper" , authenticate , users . isDeveloper ) ;
@@ -75,7 +76,7 @@ router.patch(
75
76
router . get ( "/picture/:id" , authenticate , authorizeRoles ( [ SUPERUSER ] ) , users . getUserImageForVerification ) ;
76
77
router . patch ( "/profileURL" , authenticate , userValidator . updateProfileURL , users . profileURL ) ;
77
78
router . 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 ) ;
79
80
router . get ( "/suggestedUsers/:skillId" , authenticate , authorizeRoles ( [ SUPERUSER ] ) , users . getSuggestedUsers ) ;
80
81
module . exports = router ;
81
82
router . post ( "/batch-username-update" , authenticate , authorizeRoles ( [ SUPERUSER ] ) , users . updateUsernames ) ;
0 commit comments