feat: add safe session bulk cleanup actions

This commit is contained in:
Federico Jaramillo Martinez
2026-06-08 17:20:00 +02:00
parent b2a79750a3
commit a3b5b722c9
15 changed files with 474 additions and 46 deletions
+9
View File
@@ -164,6 +164,15 @@ export function registerSessionRoutes(app: FastifyInstance, sessions: PiSessionS
}
});
app.delete<{ Params: { sessionId: string } }>(`${prefix}/sessions/:sessionId`, async (request, reply) => {
try {
await sessions.deleteArchived(request.params.sessionId);
return { deleted: true };
} catch (error) {
return reply.code(400).send({ error: error instanceof Error ? error.message : String(error) });
}
});
app.post<{ Params: { sessionId: string } }>(`${prefix}/sessions/:sessionId/detach-parent`, async (request, reply) => {
try {
await sessions.detachParent(request.params.sessionId);