feat: list + task endpoints and CORS, verified end-to-end

This commit is contained in:
2026-06-10 07:58:51 +00:00
parent 394bceca5f
commit 285bac4308
11 changed files with 143 additions and 0 deletions

15
server/api/lists.put.ts Normal file
View File

@@ -0,0 +1,15 @@
// PUT /api/lists (desktop) — full-replace catalog. Upsert all supplied; delete the rest.
export default defineEventHandler(async (event) => {
const body = await readBody(event);
if (
!Array.isArray(body) ||
body.some((l) => typeof l?.id !== "string" || typeof l?.name !== "string")
) {
throw createError({ statusCode: 400, statusMessage: "expected [{ id, name }]" });
}
await replaceLists(
getSql(),
body.map((l) => ({ id: l.id, name: l.name })),
);
return { ok: true };
});