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.
|
|
|
import express from 'express';
|
|
|
|
import validate from 'express-validation';
|
|
|
|
import middleware from '../../middlewares/staff.middleware';
|
|
|
|
import controller from '../../controllers/v1/staff.controller';
|
|
|
|
import permissions from '../../../common/utils/Permissions';
|
|
|
|
import { authorize } from '../../middlewares/auth.middleware';
|
|
|
|
import {
|
|
|
|
// listValidation,
|
|
|
|
updateValidation,
|
|
|
|
createValidation
|
|
|
|
} from '../../validations/v1/staff.validation';
|
|
|
|
|
|
|
|
const router = express.Router();
|
|
|
|
|
|
|
|
|
|
|
|
router
|
|
|
|
.route('/')
|
|
|
|
.get(
|
|
|
|
authorize([permissions.LOGGED_IN]),
|
|
|
|
middleware.count,
|
|
|
|
controller.list
|
|
|
|
)
|
|
|
|
.post(
|
|
|
|
validate(createValidation),
|
|
|
|
authorize([permissions.LOGGED_IN]),
|
|
|
|
middleware.prepareParams,
|
|
|
|
middleware.checkExistingEmail,
|
|
|
|
controller.create
|
|
|
|
);
|
|
|
|
|
|
|
|
router
|
|
|
|
.route('/:id')
|
|
|
|
.get(
|
|
|
|
middleware.load,
|
|
|
|
controller.get
|
|
|
|
)
|
|
|
|
.put(
|
|
|
|
validate(updateValidation),
|
|
|
|
authorize([permissions.LOGGED_IN]),
|
|
|
|
middleware.load,
|
|
|
|
middleware.prepareParamsUpdated,
|
|
|
|
controller.update
|
|
|
|
)
|
|
|
|
.delete(
|
|
|
|
authorize([permissions.LOGGED_IN]),
|
|
|
|
middleware.load,
|
|
|
|
controller.delete
|
|
|
|
);
|
|
|
|
router
|
|
|
|
.route('/:id/block')
|
|
|
|
.post(
|
|
|
|
authorize([permissions.LOGGED_IN]),
|
|
|
|
middleware.load,
|
|
|
|
controller.block
|
|
|
|
);
|
|
|
|
router
|
|
|
|
.route('/:id/active')
|
|
|
|
.post(
|
|
|
|
authorize([permissions.LOGGED_IN]),
|
|
|
|
middleware.load,
|
|
|
|
controller.active
|
|
|
|
);
|
|
|
|
export default router;
|
|
|
|
|