misc: added endpoint for fetching group details by ID

This commit is contained in:
Sheen Capadngan
2024-09-20 14:05:22 +08:00
parent 93b7f56337
commit 4eeea0b27c
3 changed files with 58 additions and 3 deletions
+25
View File
@@ -42,6 +42,31 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
}
});
server.route({
url: "/:id",
method: "GET",
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
schema: {
params: z.object({
id: z.string()
}),
response: {
200: GroupsSchema
}
},
handler: async (req) => {
const group = await server.services.group.getGroupById({
actor: req.permission.type,
actorId: req.permission.id,
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId,
id: req.params.id
});
return group;
}
});
server.route({
url: "/:id",
method: "PATCH",