fix(alta): error 400 del servidor ya no se reporta como 'sin conexión'
- API: viviendaCredito.ubicacion ahora opcional (la app web no la exigía; el desfase causaba 400 que la app mostraba como fallo de red) - App: crearAltaCliente distingue conexion/validacion; el 400 muestra banner rojo con el detalle de los issues en vez del banner ámbar - Tests: api 160, alta-clientes 66
This commit is contained in:
@@ -11,7 +11,7 @@ import { NotFoundError, BadRequestError } from '../utils/errors.js'
|
||||
|
||||
// ---------- Alta de clientes ----------
|
||||
|
||||
const crearClienteSchema = z
|
||||
export const crearClienteSchema = z
|
||||
.object({
|
||||
datosGenerales: z
|
||||
.object({
|
||||
@@ -32,7 +32,7 @@ const crearClienteSchema = z
|
||||
viviendaCredito: z
|
||||
.object({
|
||||
proyecto: z.string().min(1),
|
||||
ubicacion: z.string().min(1),
|
||||
ubicacion: z.string().optional(),
|
||||
valorVenta: z.union([z.string(), z.number()]).optional(),
|
||||
enganche: z.union([z.string(), z.number()]).optional(),
|
||||
})
|
||||
@@ -169,7 +169,7 @@ export async function crearCliente(req: Request, res: Response): Promise<void> {
|
||||
email: dg.email ?? null,
|
||||
celular: dg.celular ?? null,
|
||||
proyecto: vc.proyecto,
|
||||
unidadCodigo: vc.ubicacion, // la "ubicación" del formato es el código de unidad (U-101, etc.)
|
||||
unidadCodigo: vc.ubicacion ?? '', // la "ubicación" del formato es el código de unidad (U-101, etc.)
|
||||
payloadJson: JSON.stringify(body),
|
||||
firmaPng: body.firma?.firmaDataUrl ?? null,
|
||||
},
|
||||
@@ -199,7 +199,7 @@ export async function crearCliente(req: Request, res: Response): Promise<void> {
|
||||
const enganche = aNumero(vc.enganche)
|
||||
mondayApartadoId = await mondayService.crearApartado({
|
||||
clienteNombre: dg.nombreCompleto,
|
||||
unidadCodigo: vc.ubicacion,
|
||||
unidadCodigo: vc.ubicacion ?? '',
|
||||
...(enganche > 0 ? { montoApartado: enganche } : {}),
|
||||
fechaApartado: hoyMas(0),
|
||||
fechaLimite: hoyMas(15),
|
||||
|
||||
Reference in New Issue
Block a user