Fixed v2 flow

This commit is contained in:
SepehrYahyaee
2026-07-22 14:52:51 +03:30
parent 70160543a2
commit 2cc96f6132
2 changed files with 24 additions and 10 deletions

View File

@@ -6637,11 +6637,11 @@ export class RequestManagementService {
);
}
await this.verifyExpertAccessForBlameV2(req, expert);
// if (req.status !== CaseStatus.WAITING_FOR_SIGNATURES) {
// throw new BadRequestException(
// "Request is not waiting for signatures. Current status: " + req.status,
// );
// }
if (req.status !== CaseStatus.WAITING_FOR_SIGNATURES) {
throw new BadRequestException(
"Request is not waiting for signatures. Current status: " + req.status,
);
}
const partyIndex = this.getPartyIndex(req, partyRole);
if (partyIndex === -1) {
throw new BadRequestException(
@@ -6753,6 +6753,19 @@ export class RequestManagementService {
);
}
await this.verifyExpertAccessForBlameV2(req, expert);
// In the V2 IN_PERSON mirror flow guilt is resolved automatically during
// addDescriptionV2 — accident-fields must only be called once the file has
// reached WAITING_FOR_SIGNATURES (both parties' narrative steps are done).
// Calling it earlier would overwrite the workflow and skip the sign step.
if (
req.creationMethod === CreationMethod.IN_PERSON &&
req.status !== CaseStatus.WAITING_FOR_SIGNATURES &&
req.status !== CaseStatus.COMPLETED
) {
throw new BadRequestException(
`accident-fields can only be submitted after both parties have completed their narrative steps (current status: ${req.status}). Make sure both parties have gone through location, voice, and description before calling this endpoint.`,
);
}
if (!req.expert) req.expert = {} as any;
if (!req.expert.decision) req.expert.decision = {} as any;