feat: historial muestra todos los turnos del auto con estado, km y comentario
Deploy / deploy (push) Successful in 3m52s

Reemplaza HistorialServicio por Turno en ambas APIs y frontends (cliente y admin).
Muestra: servicio, fecha, horario, estado (badge), km al ingreso, observaciones del jefe.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Beldor
2026-06-22 23:19:53 -03:00
parent 112f4a07bb
commit 4a6023f9f3
4 changed files with 95 additions and 161 deletions
+4 -4
View File
@@ -14,11 +14,11 @@ export async function GET(req: NextRequest) {
const auto = await prisma.auto.findFirst({ where: { id: autoId, clienteId: sesion.sub } });
if (!auto) return NextResponse.json({ error: "Auto no encontrado" }, { status: 404 });
const historial = await prisma.historialServicio.findMany({
const turnos = await prisma.turno.findMany({
where: { autoId },
include: { admin: { select: { nombre: true } }, tipoServicio: { select: { nombre: true } } },
orderBy: { fechaRealizado: "desc" },
include: { tipoServicio: { select: { nombre: true } } },
orderBy: { fechaInicio: "desc" },
});
return NextResponse.json(historial);
return NextResponse.json(turnos);
}