forked from Yara724/api
Merge pull request 'YARA-1202' (#247) from s.yahyaee/yara724-api:main into main
Reviewed-on: Yara724/api#247
This commit is contained in:
@@ -10615,24 +10615,35 @@ export class RequestManagementService {
|
|||||||
const newRejectionCount = currentRejections + 1;
|
const newRejectionCount = currentRejections + 1;
|
||||||
const actorName = `${fileMaker.firstName || ""} ${fileMaker.lastName || ""}`.trim();
|
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, {
|
await this.claimCaseDbService.findByIdAndUpdate(claimRequestId, {
|
||||||
$set: {
|
$set: {
|
||||||
status: ClaimCaseStatus.WAITING_FOR_DAMAGE_EXPERT,
|
status: ClaimCaseStatus.WAITING_FOR_DAMAGE_EXPERT,
|
||||||
claimStatus: ClaimStatus.NEEDS_REVISION,
|
claimStatus: ClaimStatus.NEEDS_REVISION,
|
||||||
fileMakerRejectionCount: newRejectionCount,
|
fileMakerRejectionCount: newRejectionCount,
|
||||||
fileMakerRejectionReason: reason ?? null,
|
fileMakerRejectionReason: reason ?? null,
|
||||||
"workflow.currentStep": ClaimWorkflowStep.EXPERT_DAMAGE_ASSESSMENT,
|
// Reset to UPLOAD_REQUIRED_DOCUMENTS so advanceV3ClaimToOuterPartsIfReady
|
||||||
"workflow.nextStep": ClaimWorkflowStep.EXPERT_DAMAGE_ASSESSMENT,
|
// 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,
|
"workflow.locked": false,
|
||||||
},
|
},
|
||||||
// Clear all stale lock fields and prior-cycle evaluation data so the
|
// Clear all stale data from the rejected assessment cycle:
|
||||||
// FileReviewer starts a completely clean lock cycle:
|
|
||||||
// - workflow lock fields left over from the completed review cycle
|
// - workflow lock fields left over from the completed review cycle
|
||||||
// - damageExpertReply / damageExpertResend / ownerInsurerApproval /
|
// - evaluation sub-documents (reply, resend, approvals)
|
||||||
// ownerPricedPartsApproval — all belong to the rejected cycle and
|
// - damage selections: selectedParts, otherParts
|
||||||
// must not bleed into the new one (resend fulfilledAt would block
|
// - media captures: damagedPart photos, walk-around video
|
||||||
// submitResendDocsV2; stale reply would mislead the frontend)
|
// (the FileReviewer must re-select parts and re-photograph everything)
|
||||||
// - assignedForReviewBy is intentionally kept so the same reviewer
|
// - assignedForReviewBy intentionally kept so the same reviewer
|
||||||
// is still scoped to this file on re-lock
|
// is still scoped to this file on re-lock
|
||||||
$unset: {
|
$unset: {
|
||||||
"workflow.lockedAt": "",
|
"workflow.lockedAt": "",
|
||||||
@@ -10643,6 +10654,16 @@ export class RequestManagementService {
|
|||||||
"evaluation.damageExpertResend": "",
|
"evaluation.damageExpertResend": "",
|
||||||
"evaluation.ownerInsurerApproval": "",
|
"evaluation.ownerInsurerApproval": "",
|
||||||
"evaluation.ownerPricedPartsApproval": "",
|
"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: {
|
$push: {
|
||||||
history: {
|
history: {
|
||||||
|
|||||||
Reference in New Issue
Block a user