feat(shopping): GET /api/shopping-list + DELETE (Liste leeren)
Some checks failed
Build & Publish Docker Image / build-and-push (push) Has been cancelled
Some checks failed
Build & Publish Docker Image / build-and-push (push) Has been cancelled
This commit is contained in:
13
src/routes/api/shopping-list/+server.ts
Normal file
13
src/routes/api/shopping-list/+server.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import type { RequestHandler } from './$types';
|
||||||
|
import { json } from '@sveltejs/kit';
|
||||||
|
import { getDb } from '$lib/server/db';
|
||||||
|
import { clearCart, listShoppingList } from '$lib/server/shopping/repository';
|
||||||
|
|
||||||
|
export const GET: RequestHandler = async () => {
|
||||||
|
return json(listShoppingList(getDb()));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DELETE: RequestHandler = async () => {
|
||||||
|
clearCart(getDb());
|
||||||
|
return json({ ok: true });
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user