From 21790ca250a06ebcf04ff549cc716bb1a8ef1daf Mon Sep 17 00:00:00 2001 From: enlineawork Date: Thu, 10 Sep 2026 22:56:09 -0300 Subject: [PATCH] feat(api): allow empty acta before first hallazgo --- api-v3/src/inspection-acts/inspection-acts.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api-v3/src/inspection-acts/inspection-acts.service.ts b/api-v3/src/inspection-acts/inspection-acts.service.ts index 4de8913..4f0aa01 100644 --- a/api-v3/src/inspection-acts/inspection-acts.service.ts +++ b/api-v3/src/inspection-acts/inspection-acts.service.ts @@ -656,6 +656,7 @@ export class InspectionActsService { visitId: string, assetIds: string[], ): Promise { + if (assetIds.length === 0) return; const [row] = (await manager.query(` SELECT COUNT(*)::integer AS count FROM inspection_visit_assets @@ -663,7 +664,7 @@ export class InspectionActsService { AND asset_id = ANY($2::uuid[]) AND included = true `, [visitId, assetIds])) as Array<{ count: number }>; - if (assetIds.length < 1 || Number(row?.count ?? 0) !== assetIds.length) { + if (Number(row?.count ?? 0) !== assetIds.length) { throw new BadRequestException({ code: 'INSPECTION_ACT_ASSET_INVALID', message: 'Cada inventario del acta debe estar incluido en la inspección',