feat: translate API error messages to English

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ivan
2026-03-01 21:24:54 +00:00
parent 3aeda8c2fb
commit d3419a8cc5
9 changed files with 84 additions and 84 deletions

View File

@@ -20,7 +20,7 @@ export async function GET(request: NextRequest) {
if (!session?.user) {
return NextResponse.json(
{ error: 'No autorizado' },
{ error: 'Unauthorized' },
{ status: 401 }
);
}
@@ -138,7 +138,7 @@ export async function GET(request: NextRequest) {
} catch (error) {
console.error('Error fetching bookings:', error);
return NextResponse.json(
{ error: 'Error al obtener las reservas' },
{ error: 'Error fetching bookings' },
{ status: 500 }
);
}
@@ -151,7 +151,7 @@ export async function POST(request: NextRequest) {
if (!session?.user) {
return NextResponse.json(
{ error: 'No autorizado' },
{ error: 'Unauthorized' },
{ status: 401 }
);
}
@@ -163,7 +163,7 @@ export async function POST(request: NextRequest) {
if (!validationResult.success) {
return NextResponse.json(
{
error: 'Datos de reserva inválidos',
error: 'Invalid booking data',
details: validationResult.error.flatten().fieldErrors,
},
{ status: 400 }
@@ -193,14 +193,14 @@ export async function POST(request: NextRequest) {
if (!court) {
return NextResponse.json(
{ error: 'Cancha no encontrada o no pertenece a su organización' },
{ error: 'Court not found or does not belong to your organization' },
{ status: 404 }
);
}
if (court.status !== 'AVAILABLE' || !court.isActive) {
return NextResponse.json(
{ error: 'La cancha no está disponible para reservas' },
{ error: 'The court is not available for bookings' },
{ status: 400 }
);
}
@@ -232,7 +232,7 @@ export async function POST(request: NextRequest) {
if (!client) {
return NextResponse.json(
{ error: 'Cliente no encontrado o no pertenece a su organización' },
{ error: 'Client not found or does not belong to your organization' },
{ status: 404 }
);
}
@@ -269,7 +269,7 @@ export async function POST(request: NextRequest) {
if (existingBooking) {
return NextResponse.json(
{ error: 'Ya existe una reserva en ese horario. Por favor, seleccione otro horario.' },
{ error: 'A booking already exists for that time slot. Please select another time.' },
{ status: 409 }
);
}
@@ -391,7 +391,7 @@ export async function POST(request: NextRequest) {
} catch (error) {
console.error('Error creating booking:', error);
return NextResponse.json(
{ error: 'Error al crear la reserva' },
{ error: 'Error creating booking' },
{ status: 500 }
);
}