From 0b32306f84a96ee4c67f5669be6cf03834e7c6f8 Mon Sep 17 00:00:00 2001 From: leca Date: Sun, 3 Nov 2024 00:01:54 +0300 Subject: [PATCH] added new endpoint --- src/controllers/group.js | 8 ++++++++ src/routers/group.js | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/controllers/group.js b/src/controllers/group.js index d4cb0f8..9b604ca 100644 --- a/src/controllers/group.js +++ b/src/controllers/group.js @@ -65,6 +65,14 @@ class GroupController { return res.status(200).send(result); } + + async getAdminId(req, res) { + const groupId = req.params.groupId; + + let result = await GroupService.getAdminId(groupId); + + return res.status(200).send(result.toString()) + } } export default new GroupController(); diff --git a/src/routers/group.js b/src/routers/group.js index 6cedaf9..9fb0150 100644 --- a/src/routers/group.js +++ b/src/routers/group.js @@ -12,4 +12,6 @@ GroupRouter.post('/password/:groupId', tryHandler(auth.authenticate), tryHandler GroupRouter.get('/byName/:groupName', tryHandler(auth.authenticate), tryHandler(existance.groupNameExists), tryHandler(GroupController.getByName)) GroupRouter.get('/byId/:groupId', tryHandler(auth.authenticate), tryHandler(existance.groupExists), tryHandler(auth.userIsInGroup), tryHandler(GroupController.getById)) GroupRouter.get('/getUsers/:groupId', tryHandler(auth.authenticate), tryHandler(existance.groupExists), tryHandler(auth.userIsInGroup), tryHandler(GroupController.getUsersInGroup)) +GroupRouter.get('/adminId/:groupId', tryHandler(auth.authenticate), tryHandler(existance.groupExists), tryHandler(auth.userIsInGroup), tryHandler(GroupController.getAdminId)) + export default GroupRouter; \ No newline at end of file