Skip to content

Commit

Permalink
Merge pull request #213 from FSW-AND-BINAR-BATCH-6/feat/user
Browse files Browse the repository at this point in the history
update: patch data user for admin
  • Loading branch information
vierynugroho authored Jul 4, 2024
2 parents 865ea43 + bcf8cd8 commit 3f1980a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7231,7 +7231,7 @@
}
}
},
"put": {
"patch": {
"tags": ["Users"],
"summary": "Return result HIT API update user by Id",
"description": "This is an API for updatting user data based on Id",
Expand Down
16 changes: 13 additions & 3 deletions routes/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,22 @@ const {

router
.route("/")
.get(authentication, checkRole(["ADMIN"]), userController.getAllUsers,)
.post(authentication, checkRole(["ADMIN"]), validator(userCreateSchema), userController.createUser);
.get(authentication, checkRole(["ADMIN"]), userController.getAllUsers)
.post(
authentication,
checkRole(["ADMIN"]),
validator(userCreateSchema),
userController.createUser
);
router
.route("/:id")
.get(authentication, checkRole(["ADMIN"]), userController.getUserById)
.put(authentication, checkRole(["ADMIN"]), validator(userUpdateSchema), userController.updateUser)
.patch(
authentication,
checkRole(["ADMIN"]),
validator(userUpdateSchema),
userController.updateUser
)
.delete(authentication, checkRole(["ADMIN"]), userController.deleteUser);

module.exports = router;

0 comments on commit 3f1980a

Please sign in to comment.