fix(f4): require current checklist before inspection execution

This commit is contained in:
2026-09-08 14:43:02 -03:00
parent 4df8f40dd4
commit 3bfa3bce1b
2 changed files with 7 additions and 1 deletions
@@ -302,6 +302,12 @@ export class InspectionVisitLifecycleService {
message: 'Definí Área/Yacimiento, Operadora, Inspector responsable y fecha de inicio antes de planificar',
});
}
if (!visit.checklistGeneratedAt || visit.checklistGeneration < 1) {
throw new BadRequestException({
code: 'INSPECTION_CHECKLIST_REQUIRED',
message: 'Generá el checklist automático antes de confirmar la planificación',
});
}
const [relation] = await manager.query(`
SELECT 1
FROM area_company_relations
@@ -23,7 +23,7 @@ test('D5.1/F4 applies the mobile-inspector policy to every field operation', asy
assert.equal(policyCalls(acts), 3);
assert.equal(policyCalls(findings), 2);
assert.equal(policyCalls(evidence), 1);
assert.equal(policyCalls(closing), 7);
assert.equal(policyCalls(closing), 6);
assert.match(evidence, /purpose === InspectionEvidencePurpose\.OBSERVATION/);
});