You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
upload-file-backend/src/api/routes/v1/user.route.js

47 lines
1.1 KiB

2 years ago
import express from 'express';
import validate from 'express-validation';
import { authorize } from '../../middlewares/auth.middleware';
import middleware from '../../middlewares/user.middleware';
import controller from '../../controllers/v1/user.controller';
import permissions from '../../../common/utils/Permissions';
import {
listValidation,
updateValidation,
createValidation,
} from '../../validations/v1/user.validation';
const router = express.Router();
router
.route('/')
.get(
validate(listValidation),
middleware.count,
controller.list
)
.post(
validate(createValidation),
// authorize([permissions.USER_CREATE]),
middleware.checkEmail,
controller.create
);
router
.route('/:id')
.get(
middleware.load,
controller.get
)
.put(
validate(updateValidation),
authorize([permissions.USER_UPDATE]),
middleware.load,
controller.update
)
.delete(
authorize([permissions.USER_DELETE]),
middleware.load,
controller.delete
);
export default router;