feat: translate API error messages to English
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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 }
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user