1
0
forked from Yara724/api

Removed the guard of accidentWay

This commit is contained in:
SepehrYahyaee
2026-07-18 16:03:32 +03:30
parent 482d2b01f1
commit 59a1b9064e

View File

@@ -1,6 +1,5 @@
import { extname } from "node:path";
import {
BadRequestException,
Body,
Controller,
Param,
@@ -362,20 +361,6 @@ export class ExpertInitiatedBlameMirrorController {
@CurrentUser() expert: any,
@UploadedFile() sign: Express.Multer.File,
) {
// Guard: accident fields (accidentWay, etc.) must be filled before signing.
// This prevents the expert from bypassing add-accident-fields and avoids the
// double-sign bug where add-accident-fields re-enters WAITING_FOR_SIGNATURES
// after a signature was already recorded.
const requestData = await this.requestManagementService.getBlameRequestV2(
requestId,
expert,
);
if (!(requestData?.expert?.decision as any)?.fields?.accidentWay) {
throw new BadRequestException(
"Accident fields (accidentWay, accidentReason, accidentType) must be submitted via add-accident-fields before signing.",
);
}
await this.mediaPolicyService.assertForBlame(sign, requestId, "image");
const partyRole =
body?.partyRole === "SECOND" ? PartyRole.SECOND : PartyRole.FIRST;