File size: 771 Bytes
9580dce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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);
});