diff --git a/src/controllers/group.js b/src/controllers/group.js index 4ec6568..c939e02 100644 --- a/src/controllers/group.js +++ b/src/controllers/group.js @@ -39,6 +39,14 @@ class GroupController { return res.status(200).send(translate(req.headers["accept-language"], responseCodes.responses.general.ok)); } + + async getByName(req, res) { + let groupName = req.params.groupName || req.body.groupName; + + let id = await GroupService.getByName(groupName); + + return res.status(200).send(id); + } } export default new GroupController(); \ No newline at end of file diff --git a/src/routers/group.js b/src/routers/group.js index e3c4cd0..f486630 100644 --- a/src/routers/group.js +++ b/src/routers/group.js @@ -9,5 +9,6 @@ const GroupRouter = new Router(); GroupRouter.post('/create/:groupName', tryHandler(auth.authenticate), tryHandler(GroupController.create)); GroupRouter.post('/join/:groupId', tryHandler(auth.authenticate), tryHandler(existance.groupExists), tryHandler(auth.requirePassword), tryHandler(auth.checkGroupPassword), tryHandler(GroupController.join)); GroupRouter.post('/password/:groupId', tryHandler(auth.authenticate), tryHandler(existance.groupExists), tryHandler(auth.authorizeGroupOwner), tryHandler(auth.requirePassword), tryHandler(GroupController.updatePassword)); +GroupRouter.get('/byName/:groupName', tryHandler(auth.authenticate), tryHandler(existance.groupExists), tryHandler(GroupController.getByName)) export default GroupRouter; \ No newline at end of file