Files
adventure/apps/web/src/app/api/library/progress/[id]/route.ts
Zaine 3b37368e7d
Some checks failed
CI / test (push) Has been cancelled
initial 2
2026-06-26 09:26:50 +01:00

24 lines
618 B
TypeScript
Executable File

import { handleApi } from "@/lib/api";
import { logCalibrePages } from "@/lib/services/calibre-reading";
import { requireUser } from "@/lib/services/user";
import { todayString } from "@/lib/dates";
export async function POST(
request: Request,
{ params }: { params: Promise<{ id: string }> }
) {
const { id } = await params;
const calibreBookId = Number(id);
const body = await request.json();
return handleApi(async () => {
const { user } = await requireUser();
return logCalibrePages(
user.id,
calibreBookId,
body.pages ?? 10,
body.date ?? todayString()
);
});
}