forked from Yara724/api
YARA-1202
This commit is contained in:
@@ -10599,24 +10599,35 @@ export class RequestManagementService {
|
||||
const newRejectionCount = currentRejections + 1;
|
||||
const actorName = `${fileMaker.firstName || ""} ${fileMaker.lastName || ""}`.trim();
|
||||
|
||||
// Steps that belong to the damage-assessment cycle being discarded.
|
||||
// They are pulled from completedSteps so the FileReviewer can re-run them.
|
||||
const assessmentSteps = [
|
||||
ClaimWorkflowStep.SELECT_OUTER_PARTS,
|
||||
ClaimWorkflowStep.SELECT_OTHER_PARTS,
|
||||
ClaimWorkflowStep.CAPTURE_PART_DAMAGES,
|
||||
ClaimWorkflowStep.USER_SUBMISSION_COMPLETE,
|
||||
];
|
||||
|
||||
await this.claimCaseDbService.findByIdAndUpdate(claimRequestId, {
|
||||
$set: {
|
||||
status: ClaimCaseStatus.WAITING_FOR_DAMAGE_EXPERT,
|
||||
claimStatus: ClaimStatus.NEEDS_REVISION,
|
||||
fileMakerRejectionCount: newRejectionCount,
|
||||
fileMakerRejectionReason: reason ?? null,
|
||||
"workflow.currentStep": ClaimWorkflowStep.EXPERT_DAMAGE_ASSESSMENT,
|
||||
"workflow.nextStep": ClaimWorkflowStep.EXPERT_DAMAGE_ASSESSMENT,
|
||||
// Reset to UPLOAD_REQUIRED_DOCUMENTS so advanceV3ClaimToOuterPartsIfReady
|
||||
// can advance the claim to SELECT_OUTER_PARTS when the FileReviewer calls
|
||||
// select-outer-parts again.
|
||||
"workflow.currentStep": ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS,
|
||||
"workflow.nextStep": ClaimWorkflowStep.SELECT_OUTER_PARTS,
|
||||
"workflow.locked": false,
|
||||
},
|
||||
// Clear all stale lock fields and prior-cycle evaluation data so the
|
||||
// FileReviewer starts a completely clean lock cycle:
|
||||
// Clear all stale data from the rejected assessment cycle:
|
||||
// - workflow lock fields left over from the completed review cycle
|
||||
// - damageExpertReply / damageExpertResend / ownerInsurerApproval /
|
||||
// ownerPricedPartsApproval — all belong to the rejected cycle and
|
||||
// must not bleed into the new one (resend fulfilledAt would block
|
||||
// submitResendDocsV2; stale reply would mislead the frontend)
|
||||
// - assignedForReviewBy is intentionally kept so the same reviewer
|
||||
// - evaluation sub-documents (reply, resend, approvals)
|
||||
// - damage selections: selectedParts, otherParts
|
||||
// - media captures: damagedPart photos, walk-around video
|
||||
// (the FileReviewer must re-select parts and re-photograph everything)
|
||||
// - assignedForReviewBy intentionally kept so the same reviewer
|
||||
// is still scoped to this file on re-lock
|
||||
$unset: {
|
||||
"workflow.lockedAt": "",
|
||||
@@ -10627,6 +10638,16 @@ export class RequestManagementService {
|
||||
"evaluation.damageExpertResend": "",
|
||||
"evaluation.ownerInsurerApproval": "",
|
||||
"evaluation.ownerPricedPartsApproval": "",
|
||||
"damage.selectedParts": "",
|
||||
"damage.otherParts": "",
|
||||
"media.damagedParts": "",
|
||||
"media.captures": "",
|
||||
"media.videoCaptureId": "",
|
||||
},
|
||||
// Remove assessment-cycle steps from completedSteps so none of the
|
||||
// "already completed" guards fire when the FileReviewer re-runs them.
|
||||
$pull: {
|
||||
"workflow.completedSteps": { $in: assessmentSteps },
|
||||
},
|
||||
$push: {
|
||||
history: {
|
||||
|
||||
Reference in New Issue
Block a user