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);