initial 2
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-06-26 09:26:50 +01:00
parent 194330fb47
commit 3b37368e7d
213 changed files with 14688 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
import { handleApi } from "@/lib/api";
import {
getWeeklyReview,
generateWeeklyReview,
setReviewIntention,
} from "@/lib/services/explorations";
import { requireUser } from "@/lib/services/user";
export async function GET(
_request: Request,
{ params }: { params: Promise<{ weekStart: string }> }
) {
const { weekStart } = await params;
return handleApi(async () => {
const { user } = await requireUser();
return getWeeklyReview(user.id, weekStart);
});
}
export async function POST(
request: Request,
{ params }: { params: Promise<{ weekStart: string }> }
) {
const { weekStart } = await params;
const body = await request.json();
return handleApi(async () => {
const { user } = await requireUser();
if (body.action === "generate") {
return generateWeeklyReview(user.id, weekStart);
}
if (body.intention) {
await setReviewIntention(user.id, weekStart, body.intention);
return { ok: true };
}
throw new Error("Unknown action");
});
}