Commit
Add DELETE session route
commit
e4e29b0
1 changed file with +6 and −0
modified server/routes/sessions.ts +6 −0
| @@ -31,6 +31,12 @@export function registerSessionRoutes(app: FastifyInstance, deps: SessionRouteDe | ||
| 31 | 31 | return session |
| 32 | 32 | }) |
| 33 | 33 | |
| 34 | + app.delete<{ Params: { id: string } }>('/api/sessions/:id', async (request, reply) => { | |
| 35 | + const deleted = await store.deleteSession(request.params.id) | |
| 36 | + if (!deleted) return reply.code(404).send({ error: 'session not found' }) | |
| 37 | + return reply.code(204).send() | |
| 38 | + }) | |
| 39 | + | |
| 34 | 40 | app.post<{ Params: { id: string } }>('/api/sessions/:id/answer', async (request, reply) => { |
| 35 | 41 | const parsed = AnswerRequestSchema.safeParse(request.body) |
| 36 | 42 | if (!parsed.success) { |