feat: Puente Mayúscula-Minúscula + TTS SpeechSynthesis + E2E fixes
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { NextRequest, NextResponse } from "next/server"
|
||||
import { prisma } from "@/lib/db"
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const childId = request.nextUrl.searchParams.get("childId")
|
||||
if (!childId) {
|
||||
return NextResponse.json({ error: "childId required" }, { status: 400 })
|
||||
}
|
||||
const milestones = await prisma.milestone.findMany({
|
||||
where: { childId },
|
||||
orderBy: { reachedAt: "desc" },
|
||||
})
|
||||
return NextResponse.json(milestones)
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
const { childId, skillCode } = await request.json()
|
||||
if (!childId || !skillCode) {
|
||||
return NextResponse.json({ error: "childId and skillCode required" }, { status: 400 })
|
||||
}
|
||||
const existing = await prisma.milestone.findUnique({
|
||||
where: { childId_skillCode: { childId, skillCode } },
|
||||
})
|
||||
if (existing) {
|
||||
return NextResponse.json(existing)
|
||||
}
|
||||
const milestone = await prisma.milestone.create({
|
||||
data: { childId, skillCode },
|
||||
})
|
||||
return NextResponse.json(milestone, { status: 201 })
|
||||
} catch (error) {
|
||||
console.error("Milestone error:", error)
|
||||
return NextResponse.json({ error: "Internal error" }, { status: 500 })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user