import { Router } from 'express'; import auth from '../middlewares/auth.js'; import GroupController from '../controllers/group.js'; 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); GroupRouter.post('/password/:groupId', auth.authenticate, existance.groupExists, auth.authorizeGroupOwner, auth.requirePassword, GroupController.updatePassword); export default GroupRouter;