feat: Puente Mayúscula-Minúscula + TTS SpeechSynthesis + E2E fixes
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import { NextRequest, NextResponse } from "next/server"
|
||||
import { prisma } from "@/lib/db"
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
const { childId, exerciseId, skillCode, correct, promptLevel, responseMs, errorType, stage } = await request.json()
|
||||
|
||||
if (!childId || !exerciseId || !skillCode) {
|
||||
return NextResponse.json({ error: "Missing required fields" }, { status: 400 })
|
||||
}
|
||||
|
||||
const sessionLog = await prisma.sessionLog.findFirst({
|
||||
where: { childId },
|
||||
orderBy: { startedAt: "desc" },
|
||||
})
|
||||
|
||||
if (!sessionLog) {
|
||||
return NextResponse.json({ error: "No active session" }, { status: 400 })
|
||||
}
|
||||
|
||||
await prisma.skillAttempt.create({
|
||||
data: {
|
||||
sessionLogId: sessionLog.id,
|
||||
skillCode,
|
||||
promptLevel: promptLevel ?? 0,
|
||||
correct,
|
||||
responseMs: responseMs ?? null,
|
||||
errorType: errorType ?? null,
|
||||
exerciseId,
|
||||
stage: stage ?? null,
|
||||
},
|
||||
})
|
||||
|
||||
return NextResponse.json({ success: true })
|
||||
} catch (error) {
|
||||
console.error("Curriculum grade error:", error)
|
||||
return NextResponse.json({ error: "Internal error" }, { status: 500 })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user