forked from Yara724/api
Fixed rejection flow data on v5
This commit is contained in:
@@ -10615,51 +10615,30 @@ export class RequestManagementService {
|
||||
const newRejectionCount = currentRejections + 1;
|
||||
const actorName = `${fileMaker.firstName || ""} ${fileMaker.lastName || ""}`.trim();
|
||||
|
||||
// Steps that belong to the re-run assessment cycle.
|
||||
// Pulled from completedSteps so workflow ordering guards pass on re-run.
|
||||
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,
|
||||
// Land directly at SELECT_OUTER_PARTS: the FileReviewer sees the
|
||||
// existing parts pre-populated and can adjust or confirm them.
|
||||
"workflow.currentStep": ClaimWorkflowStep.SELECT_OUTER_PARTS,
|
||||
"workflow.nextStep": ClaimWorkflowStep.SELECT_OTHER_PARTS,
|
||||
"workflow.currentStep": ClaimWorkflowStep.EXPERT_DAMAGE_ASSESSMENT,
|
||||
"workflow.nextStep": ClaimWorkflowStep.EXPERT_DAMAGE_ASSESSMENT,
|
||||
"workflow.locked": false,
|
||||
// Flag consumed by selectOuterPartsV2 / selectOtherPartsV2 to allow
|
||||
// overwriting previously submitted data instead of throwing ConflictException.
|
||||
"fileMakerRejectedPendingReview": true,
|
||||
},
|
||||
// Clear stale lock/evaluation fields and media that must be re-captured.
|
||||
// Part selections (damage.selectedParts, damage.otherParts) are intentionally
|
||||
// preserved as a pre-populated starting point for the FileReviewer to adjust.
|
||||
// Clear stale lock fields and the owner-cycle evaluation data.
|
||||
// evaluation.damageExpertReply is intentionally preserved so the FileReviewer
|
||||
// sees their previous prices / daghi / severity pre-populated in the claim
|
||||
// detail and can adjust them. submitExpertReplyV2 overwrites it with $set.
|
||||
// - assignedForReviewBy intentionally kept so the same reviewer
|
||||
// is still scoped to this file on re-lock.
|
||||
$unset: {
|
||||
"workflow.lockedAt": "",
|
||||
"workflow.expiredAt": "",
|
||||
"workflow.lockedBy": "",
|
||||
"workflow.preLockQueueSnapshot": "",
|
||||
"evaluation.damageExpertReply": "",
|
||||
"evaluation.damageExpertResend": "",
|
||||
"evaluation.ownerInsurerApproval": "",
|
||||
"evaluation.ownerPricedPartsApproval": "",
|
||||
// Photos and walk-around video must be re-taken for the new part set.
|
||||
"media.damagedParts": "",
|
||||
"media.captures": "",
|
||||
"media.videoCaptureId": "",
|
||||
},
|
||||
// Remove assessment-cycle steps from completedSteps so workflow ordering
|
||||
// guards pass when the FileReviewer re-runs each step.
|
||||
$pull: {
|
||||
"workflow.completedSteps": { $in: assessmentSteps },
|
||||
},
|
||||
$push: {
|
||||
history: {
|
||||
|
||||
Reference in New Issue
Block a user