feat(f6.8): harden offline field flow and act documents
Android CI / RC / Android · lint, tests, debug APK, release compile (push) Successful in 3m41s
DH V2 CI / API · typecheck, tests, build (push) Successful in 31s
DH V2 CI / WEB · typecheck, build (push) Successful in 19s
Production dependency audit / API · production dependencies (push) Successful in 9s
Production dependency audit / WEB · production dependencies (push) Successful in 8s
DH V2 CI / Docker / scripts contract (push) Successful in 1m14s
Android CI / RC / Android · lint, tests, debug APK, release compile (push) Successful in 3m41s
DH V2 CI / API · typecheck, tests, build (push) Successful in 31s
DH V2 CI / WEB · typecheck, build (push) Successful in 19s
Production dependency audit / API · production dependencies (push) Successful in 9s
Production dependency audit / WEB · production dependencies (push) Successful in 8s
DH V2 CI / Docker / scripts contract (push) Successful in 1m14s
This commit is contained in:
@@ -153,6 +153,22 @@ export class InspectionEvidenceService {
|
||||
assertMobileInspector(principal);
|
||||
}
|
||||
this.validateCoordinates(dto.latitude, dto.longitude, dto.accuracyM);
|
||||
if (dto.operationId) {
|
||||
const [existing] = await this.dataSource.query(
|
||||
`${this.evidenceSelect()} WHERE evidence.client_operation_id = $1`,
|
||||
[dto.operationId],
|
||||
) as StoredInspectionEvidence[];
|
||||
if (existing) {
|
||||
if (existing.findingId !== findingId) {
|
||||
throw new ConflictException({
|
||||
code: 'INSPECTION_EVIDENCE_OPERATION_REUSED',
|
||||
message: 'La operación offline ya fue utilizada para otra evidencia',
|
||||
});
|
||||
}
|
||||
const { storedName: _storedName, ...view } = existing;
|
||||
return view;
|
||||
}
|
||||
}
|
||||
const inspected = inspectInspectionEvidenceFile(file, dto.kind);
|
||||
this.validatePurpose(dto, inspected.mimeType);
|
||||
|
||||
@@ -210,12 +226,12 @@ export class InspectionEvidenceService {
|
||||
id, finding_id, communication_id, verification_visit_id, kind, purpose,
|
||||
original_name, stored_name, mime_type, size_bytes, sha256,
|
||||
title, description, captured_at, latitude, longitude, accuracy_m,
|
||||
device_label, source, uploaded_by
|
||||
device_label, source, uploaded_by, client_operation_id
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6,
|
||||
$7, $8, $9, $10, $11,
|
||||
$12, $13, $14, $15, $16, $17,
|
||||
$18, $19, $20
|
||||
$18, $19, $20, $21
|
||||
)
|
||||
`, [
|
||||
id,
|
||||
@@ -238,6 +254,7 @@ export class InspectionEvidenceService {
|
||||
dto.deviceLabel?.trim() || null,
|
||||
source,
|
||||
principal.userId,
|
||||
dto.operationId ?? null,
|
||||
]);
|
||||
const created = await this.loadEvidence(manager, id);
|
||||
await this.audit.record({
|
||||
|
||||
Reference in New Issue
Block a user