fix: add missing DELETE /api/v1/journal/:date endpoint

This commit is contained in:
lotherk
2026-03-27 02:58:32 +00:00
parent 8b7156ba3c
commit 0b4d5bad58

View File

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