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

@@ -11,7 +11,7 @@ export async function GET(request: NextRequest) {
if (!session?.user) {
return NextResponse.json(
{ error: 'No autorizado' },
{ error: 'Unauthorized' },
{ status: 401 }
);
}
@@ -123,7 +123,7 @@ export async function GET(request: NextRequest) {
} catch (error) {
console.error('Error fetching clients:', error);
return NextResponse.json(
{ error: 'Error al obtener los clientes' },
{ error: 'Error fetching clients' },
{ status: 500 }
);
}
@@ -136,7 +136,7 @@ export async function POST(request: NextRequest) {
if (!session?.user) {
return NextResponse.json(
{ error: 'No autorizado' },
{ error: 'Unauthorized' },
{ status: 401 }
);
}
@@ -148,7 +148,7 @@ export async function POST(request: NextRequest) {
if (!validationResult.success) {
return NextResponse.json(
{
error: 'Datos del cliente inválidos',
error: 'Invalid client data',
details: validationResult.error.flatten().fieldErrors,
},
{ status: 400 }
@@ -181,7 +181,7 @@ export async function POST(request: NextRequest) {
if (existingClient) {
return NextResponse.json(
{ error: 'Ya existe un cliente con este correo electrónico en su organización' },
{ error: 'A client with this email already exists in your organization' },
{ status: 409 }
);
}
@@ -224,13 +224,13 @@ export async function POST(request: NextRequest) {
// Check for unique constraint violation
if (error instanceof Error && error.message.includes('Unique constraint')) {
return NextResponse.json(
{ error: 'Ya existe un cliente con este correo electrónico o DNI' },
{ error: 'A client with this email or ID number already exists' },
{ status: 409 }
);
}
return NextResponse.json(
{ error: 'Error al crear el cliente' },
{ error: 'Error creating client' },
{ status: 500 }
);
}