fix: add missing DELETE /api/v1/journal/:date endpoint
This commit is contained in:
@@ -564,6 +564,19 @@ app.get('/api/v1/journal/:date', async (c) => {
|
|||||||
return c.json({ data: journal, error: null });
|
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) => {
|
app.get('/api/v1/journals', async (c) => {
|
||||||
const userId = await getUserId(c);
|
const userId = await getUserId(c);
|
||||||
if (!userId) return c.json({ data: null, error: { code: 'UNAUTHORIZED', message: 'Invalid API key' } }, 401);
|
if (!userId) return c.json({ data: null, error: { code: 'UNAUTHORIZED', message: 'Invalid API key' } }, 401);
|
||||||
|
|||||||
Reference in New Issue
Block a user