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
+33
View File
@@ -0,0 +1,33 @@
import { apiJson, withApiHandler } from "@/lib/api-handler";
import { createListForScope } from "@/modules/lists/server/actions";
import { listInput } from "@/modules/lists/server/schemas";
import { listListsForScope } from "@/modules/lists/server/queries";
export async function GET(request: Request) {
return withApiHandler(request, async (scope, req) => {
const url = new URL(req.url);
const type = url.searchParams.get("type") ?? undefined;
const lists = await listListsForScope(scope.householdId, type ? { type } : undefined);
return apiJson(lists);
});
}
export async function POST(request: Request) {
return withApiHandler(request, async (scope, req) => {
const body: unknown = await req.json();
const parsed = listInput.parse(body);
const list = await createListForScope(scope, parsed);
return apiJson(
{
id: list.id,
type: list.type,
name: list.name,
archived: list.archived,
openCount: 0,
doneCount: 0,
createdAt: list.createdAt.toISOString(),
},
201,
);
});
}