Add study activity tracking and refresh class header UI
All checks were successful
Automated Container Build / build-and-push (push) Successful in 54s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 54s
This commit is contained in:
parent
95af276d2e
commit
dad62c9914
21 changed files with 1598 additions and 44 deletions
17
src/app/api/activity/route.ts
Normal file
17
src/app/api/activity/route.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { studyActivitySchema } from "@/lib/validation/activitySchemas";
|
||||
import * as activityService from "@/services/activityService";
|
||||
|
||||
export async function GET() {
|
||||
return NextResponse.json(await activityService.getActivitySummary());
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const parsed = studyActivitySchema.safeParse(await request.json().catch(() => null));
|
||||
if (!parsed.success) {
|
||||
return NextResponse.json({ error: "Invalid activity type" }, { status: 400 });
|
||||
}
|
||||
|
||||
await activityService.recordActivity(parsed.data.type);
|
||||
return NextResponse.json({ success: true }, { status: 201 });
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue