Skip to content
Snippets Groups Projects
Commit 60a31af1 authored by fu6454io's avatar fu6454io
Browse files

fixed update info/user route

parent d460d412
No related branches found
No related tags found
No related merge requests found
......@@ -6,20 +6,21 @@ import { body } from "express-validator";
const userRouter = Router();
//show current user
userRouter.get(
"/api/user/",
validateToken,
userControllers.showCurrentUserController
);
//update current user
userRouter.patch(
"/api/user/",
body("first_name").not().isEmpty(),
body("last_name").not().isEmpty(),
body("email").isEmail().normalizeEmail(),
body("role").isIn(["coordinator", "boatManager"]),
body("password").isLength({ min: 6 }),
body("first_name").if(body("first_name").exists()).not().isEmpty(),
body("last_name").if(body("last_name").exists()).not().isEmpty(),
body("email").if(body("email").exists()).isEmail().normalizeEmail(),
body("password").if(body("password").exists()).isLength({ min: 6 }),
handleValidationResult,
validateToken,
userControllers.updateCurrentUser
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment