From 0b4d5bad58d04018851ad7b0faf4f1c5f99f0ccf Mon Sep 17 00:00:00 2001 From: lotherk Date: Fri, 27 Mar 2026 02:58:32 +0000 Subject: [PATCH] fix: add missing DELETE /api/v1/journal/:date endpoint --- backend/src/index.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backend/src/index.ts b/backend/src/index.ts index ce3b784..83e121b 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -564,6 +564,19 @@ app.get('/api/v1/journal/:date', async (c) => { return c.json({ data: journal, error: null }); }); +app.delete('/api/v1/journal/:date', async (c) => { + const userId = await getUserId(c); + if (!userId) return c.json({ data: null, error: { code: 'UNAUTHORIZED', message: 'Invalid API key' } }, 401); + + const { date } = c.req.param(); + + await prisma.journal.deleteMany({ + where: { userId, date }, + }); + + return c.json({ data: { deleted: true }, error: null }); +}); + app.get('/api/v1/journals', async (c) => { const userId = await getUserId(c); if (!userId) return c.json({ data: null, error: { code: 'UNAUTHORIZED', message: 'Invalid API key' } }, 401);