70 lines
1.4 KiB
JavaScript
70 lines
1.4 KiB
JavaScript
/**
|
|
* Copyright (c) 2026 Niolla
|
|
* All rights reserved.
|
|
*
|
|
* This source code is proprietary and confidential.
|
|
* Unauthorized copying, modification, distribution, or use
|
|
* of this file, via any medium, is strictly prohibited.
|
|
*/
|
|
|
|
// app/routes/user.routes.js
|
|
|
|
const express = require("express");
|
|
const router = express.Router();
|
|
const userController = require("../controllers/user.controller");
|
|
const {
|
|
authenticate,
|
|
} = require("../middleware/auth.middleware");
|
|
|
|
const { authorizedAccountType, checkPermission } = require("../middleware/permission.middleware");
|
|
const PERMISSIONS = require("../constants/permissions");
|
|
|
|
|
|
router.post(
|
|
"/",
|
|
// authenticate,
|
|
// authorizedAccountType(["admin"]),
|
|
userController.createNewUser
|
|
);
|
|
|
|
router.post(
|
|
"/verify-email",
|
|
userController.verifyEmail
|
|
);
|
|
|
|
router.get(
|
|
"/profile",
|
|
authenticate,
|
|
userController.userProfile
|
|
);
|
|
|
|
router.get(
|
|
"/",
|
|
authenticate,
|
|
authorizedAccountType(["admin"]),
|
|
userController.getAllUsers
|
|
);
|
|
|
|
// router.get(
|
|
// "/:id",
|
|
// authenticate,
|
|
// authorizedAccountType(["admin", "management", "team_head", "user"]),
|
|
// userController.getUserById
|
|
// );
|
|
|
|
router.patch(
|
|
"/:id",
|
|
authenticate,
|
|
authorizedAccountType(["admin", "management", "team_head", "user"]),
|
|
userController.updateUser
|
|
);
|
|
|
|
router.delete(
|
|
"/:id",
|
|
authenticate,
|
|
authorizedAccountType(["admin"]),
|
|
userController.deleteUser
|
|
);
|
|
|
|
module.exports = router;
|