bsfe_server/src/routers/group.js

12 lines
673 B
JavaScript
Raw Normal View History

2024-10-26 05:31:22 +03:00
import { Router } from 'express';
import auth from '../middlewares/auth.js';
2024-10-27 05:45:12 +03:00
import GroupController from '../controllers/group.js';
2024-10-26 05:31:22 +03:00
import existance from '../middlewares/existance.js';
const GroupRouter = new Router();
GroupRouter.post('/create/:groupName', auth.authenticate, existance.groupNameDoesntExist, GroupController.create);
GroupRouter.post('/join/:groupId', auth.authenticate, existance.groupExists, auth.requirePassword, auth.checkGroupPassword, GroupController.join);
2024-10-27 05:45:12 +03:00
GroupRouter.post('/password/:groupId', auth.authenticate, existance.groupExists, auth.authorizeGroupOwner, auth.requirePassword, GroupController.updatePassword);
2024-10-26 05:31:22 +03:00
export default GroupRouter;