added new endpoint
This commit is contained in:
parent
d4233c72f5
commit
9cd1debd4a
|
@ -39,6 +39,14 @@ class GroupController {
|
||||||
|
|
||||||
return res.status(200).send(translate(req.headers["accept-language"], responseCodes.responses.general.ok));
|
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();
|
export default new GroupController();
|
|
@ -9,5 +9,6 @@ const GroupRouter = new Router();
|
||||||
GroupRouter.post('/create/:groupName', tryHandler(auth.authenticate), tryHandler(GroupController.create));
|
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('/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.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;
|
export default GroupRouter;
|
Loading…
Reference in New Issue