feat: agrega km y chasis al turno/auto, combobox de marcas y modelos
Deploy / deploy (push) Failing after 13m41s
Deploy / deploy (push) Failing after 13m41s
- Turno.kilometros (requerido al reservar) - Auto.nroChasis (opcional) - Combobox con 60 marcas mundiales y modelos precargados - Modelo se habilita al seleccionar marca Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@ export async function POST(req: NextRequest) {
|
||||
const sesion = await verificarSesion("cliente_session");
|
||||
if (!sesion) return NextResponse.json({ error: "No autorizado" }, { status: 401 });
|
||||
|
||||
const { patente, marca, modelo, anio } = await req.json();
|
||||
const { patente, marca, modelo, anio, nroChasis } = await req.json();
|
||||
if (!patente || !marca || !modelo || !anio)
|
||||
return NextResponse.json({ error: "Todos los campos son requeridos" }, { status: 400 });
|
||||
|
||||
@@ -32,6 +32,7 @@ export async function POST(req: NextRequest) {
|
||||
marca,
|
||||
modelo,
|
||||
anio: Number(anio),
|
||||
nroChasis: nroChasis?.trim() || null,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ export async function POST(req: NextRequest) {
|
||||
const sesion = await verificarSesion("cliente_session");
|
||||
if (!sesion) return NextResponse.json({ error: "No autorizado" }, { status: 401 });
|
||||
|
||||
const { autoId, tipoServicioId, fechaInicio } = await req.json();
|
||||
if (!autoId || !tipoServicioId || !fechaInicio)
|
||||
const { autoId, tipoServicioId, fechaInicio, kilometros } = await req.json();
|
||||
if (!autoId || !tipoServicioId || !fechaInicio || !kilometros)
|
||||
return NextResponse.json({ error: "Datos incompletos" }, { status: 400 });
|
||||
|
||||
// Verificar que el auto pertenece al cliente
|
||||
@@ -42,7 +42,7 @@ export async function POST(req: NextRequest) {
|
||||
return NextResponse.json({ error: "El horario ya no está disponible" }, { status: 409 });
|
||||
|
||||
const turno = await prisma.turno.create({
|
||||
data: { clienteId: sesion.sub, autoId, tipoServicioId, fechaInicio: inicio, fechaFin: fin },
|
||||
data: { clienteId: sesion.sub, autoId, tipoServicioId, fechaInicio: inicio, fechaFin: fin, kilometros: Number(kilometros) },
|
||||
include: { auto: true, tipoServicio: true },
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user