import type { MoveAttendee as MoveAttendeeBody } from '@gruperly/shared'; import { MoveAttendeeSchema } from '@gruperly/shared'; import { Hono } from 'hono'; import { problemJson, resultJson, unauthorizedProblem } from '@/http/problem-details'; import { validate } from '@/http/validate'; import { MoveAttendee } from './use-case'; const route = new Hono(); route.post('/:groupId/attendees/:attendeeId/move', validate.json(MoveAttendeeSchema), async (c) => { const user = c.get('user'); if (!user) return problemJson(c, unauthorizedProblem(c.req.path)); const useCase = new MoveAttendee(); const result = await useCase.execute({ groupId: c.req.param('groupId'), attendeeId: c.req.param('attendeeId'), userId: user.id, targetGroupId: (c.req.valid('json') as MoveAttendeeBody).targetGroupId, }); return resultJson(c, result); }); export default route;