feat: api v1 routes for calendar lists and notes

This commit is contained in:
ginnoir
2026-07-04 19:03:08 -05:00
parent ea5d1d050c
commit d4304b005c
25 changed files with 1141 additions and 236 deletions
+20
View File
@@ -0,0 +1,20 @@
import { apiJson, withApiHandler } from "@/lib/api-handler";
import { createNoteForScope } from "@/modules/notes/server/actions";
import { noteInput } from "@/modules/notes/server/schemas";
import { listNotesForScope } from "@/modules/notes/server/queries";
export async function GET(request: Request) {
return withApiHandler(request, async (scope) => {
const notes = await listNotesForScope(scope.householdId);
return apiJson(notes);
});
}
export async function POST(request: Request) {
return withApiHandler(request, async (scope, req) => {
const body: unknown = await req.json();
const parsed = noteInput.parse(body);
const note = await createNoteForScope(scope, parsed);
return apiJson(note, 201);
});
}