Initial attendee management

This commit is contained in:
Jose Selesan
2026-09-18 09:42:37 -03:00
parent fa30fe2cff
commit d7ebb5b234
111 changed files with 13784 additions and 36 deletions

View File

@@ -0,0 +1,21 @@
import { type CreateAttendee, CreateAttendeeSchema } from '@gruperly/shared';
import { Hono } from 'hono';
import { problemJson, resultJson, unauthorizedProblem } from '@/http/problem-details';
import { validate } from '@/http/validate';
import { CreateAttendeeUseCase } from './use-case';
const route = new Hono();
route.post('/:groupId/attendees', validate.json(CreateAttendeeSchema), async (c) => {
const user = c.get('user');
if (!user) {
return problemJson(c, unauthorizedProblem(c.req.path));
}
const groupId = c.req.param('groupId');
const body = c.req.valid('json') as CreateAttendee;
const useCase = new CreateAttendeeUseCase();
const result = await useCase.execute(groupId, user.id, body);
return resultJson(c, result, { status: 201 });
});
export default route;