import { Router } from 'express'; import auth from '../middlewares/auth.js'; import GroupController from '../controllers/group.js'; import tryHandler from '../response/errorHandler.js'; const GroupRouter = new Router(); GroupRouter.post('/create/:groupName', tryHandler(auth.authenticate), tryHandler(GroupController.create)); GroupRouter.post('/join/:groupId', tryHandler(auth.authenticate), tryHandler(auth.requirePassword), tryHandler(auth.checkGroupPassword), tryHandler(GroupController.join)); GroupRouter.post('/password/:groupId', tryHandler(auth.authenticate), tryHandler(auth.authorizeGroupOwner), tryHandler(auth.requirePassword), tryHandler(GroupController.updatePassword)); export default GroupRouter;