RotNot / src /app /api /coach /difficulty /route.ts
deploy
Deploy RotNot
9580dce
Raw History Blame Contribute Delete
771 Bytes
import { NextResponse } from "next/server";
import { withApiError } from "@/lib/api-error";
import { getPerformanceSummary } from "@/lib/performance";
import { getRecommendedSettings } from "@/lib/difficulty";
/**
* GET /api/coach/difficulty
*
* Returns per-category difficulty recommendations based on the current
* performance summary for user 1.
*
* Response shape:
* {
* recommendations: {
* [category]: { difficulty, nextSkill, adjustmentReason, hasHistory }
* },
* updatedAt: string
* }
*
* Part 2 of the Active Coach roadmap (Issue #6).
*/
export const GET = withApiError(async () => {
const summary = await getPerformanceSummary(1);
const result = getRecommendedSettings(summary);
return NextResponse.json(result);
});