feat: scope every API endpoint to the token's sub; expose ownerId in DTOs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 08:27:26 +00:00
parent 0e16738624
commit 03fbe06a04
9 changed files with 36 additions and 26 deletions

View File

@@ -1,4 +1,6 @@
// PUT /api/lists (desktop) — full-replace catalog. Upsert all supplied; delete the rest.
// PUT /api/lists (desktop) — full-replace of the caller's catalog. Upsert all supplied;
// delete the caller's lists not present. Any client-supplied ownerId is ignored — the
// server stamps ownership from the verified token.
export default defineEventHandler(async (event) => {
const body = await readBody(event);
if (
@@ -9,6 +11,7 @@ export default defineEventHandler(async (event) => {
}
await replaceLists(
getSql(),
ownerOf(event),
body.map((l) => ({ id: l.id, name: l.name })),
);
return { ok: true };