generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated /users/:userId PATCH Endpoint (#2316)
* updated userId route for self patch request based on userid * removed console line * added feature flag * return res fix
- Loading branch information
1 parent
7269b1f
commit 439658f
Showing
5 changed files
with
474 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const conditionalMiddleware = (validator) => { | ||
return async (req, res, next) => { | ||
if (req.params.userId === req.userData.id && req.query.profile === "true") { | ||
return validator(req, res, next); | ||
} | ||
next(); | ||
}; | ||
}; | ||
|
||
module.exports = conditionalMiddleware; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.