fix: close F4 pre-merge review gaps
This commit is contained in:
@@ -49,7 +49,7 @@ export class ActAdministrationService {
|
||||
COUNT(*) FILTER (WHERE f.status = 'OPEN' AND f.next_control_on IS NOT NULL) AS scheduled_control_count
|
||||
FROM inspection_findings f WHERE f.act_id = ia.id
|
||||
) fc ON true
|
||||
WHERE ia.status IN ('CLOSED', 'RECTIFIED')
|
||||
WHERE ia.status IN ('SEALED', 'CLOSED', 'RECTIFIED')
|
||||
), classified AS (
|
||||
SELECT *, CASE
|
||||
WHEN "findingCount" > 0 AND "openFindingCount" = 0 THEN 'REGULARIZED'
|
||||
@@ -110,7 +110,7 @@ export class ActAdministrationService {
|
||||
const rows = await this.dataSource.query(`SELECT id, code, status FROM inspection_acts WHERE id = $1`, [actId]);
|
||||
const act = rows[0];
|
||||
if (!act) throw new NotFoundException({ code: 'ACT_NOT_FOUND', message: 'Acta inexistente.' });
|
||||
if (!['CLOSED', 'RECTIFIED'].includes(act.status)) throw new BadRequestException({ code: 'ACT_ADMIN_REQUIRES_CLOSED', message: 'El seguimiento administrativo comienza cuando el Acta está cerrada.' });
|
||||
if (!['SEALED', 'CLOSED', 'RECTIFIED'].includes(act.status)) throw new BadRequestException({ code: 'ACT_ADMIN_REQUIRES_SEALED', message: 'El seguimiento administrativo comienza cuando el Acta está sellada.' });
|
||||
return act;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ export class FieldBriefingService {
|
||||
ORDER BY company_response.received_on DESC, company_response.created_at DESC, company_response.id DESC
|
||||
LIMIT 1
|
||||
) response ON true
|
||||
WHERE act.status IN ('CLOSED', 'RECTIFIED')
|
||||
WHERE act.status IN ('SEALED', 'CLOSED', 'RECTIFIED')
|
||||
AND source_visit.id <> $1
|
||||
AND source_visit.operational_area_id = $2::uuid
|
||||
AND source_visit.operator_company_id = $3::uuid
|
||||
|
||||
+8
@@ -22,6 +22,10 @@ export class F4AlignDocumentLifecycleConstraints1790000600000 implements Migrati
|
||||
status IN ('WORKING','OFFICIALIZED','FROZEN','CANCELLED')
|
||||
)
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE inspection_reports
|
||||
ALTER COLUMN status SET DEFAULT 'WORKING'
|
||||
`);
|
||||
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE inspection_acts
|
||||
@@ -163,6 +167,10 @@ export class F4AlignDocumentLifecycleConstraints1790000600000 implements Migrati
|
||||
SET status='FROZEN'
|
||||
WHERE status IN ('WORKING','OFFICIALIZED')
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE inspection_reports
|
||||
ALTER COLUMN status SET DEFAULT 'FROZEN'
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE inspection_reports
|
||||
DROP CONSTRAINT IF EXISTS chk_inspection_reports_status
|
||||
|
||||
@@ -549,14 +549,7 @@ export class InspectionClosingService {
|
||||
if (companyOutcomes.length !== 1) {
|
||||
throw new ConflictException({
|
||||
code: 'INSPECTION_ACT_COMPANY_OUTCOME_REQUIRED',
|
||||
message: 'Debe existir exactamente una firma, disidencia o negativa del responsable de la empresa',
|
||||
});
|
||||
}
|
||||
const companyOutcome = companyOutcomes[0];
|
||||
if (companyOutcome.status === InspectionActSignatureStatus.ABSENT) {
|
||||
throw new ConflictException({
|
||||
code: 'INSPECTION_ACT_COMPANY_MANIFESTATION_PENDING',
|
||||
message: 'La ausencia no reemplaza la firma o negativa; la manifestación de la empresa sigue pendiente',
|
||||
message: 'Debe existir exactamente una firma, disidencia, negativa o ausencia documentada del responsable de la empresa',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user