From 8460c86820dcb72c4fee73d6ca3db9ad81f861e8 Mon Sep 17 00:00:00 2001 From: SepehrYahyaee <7heycallmegray@gmail.com> Date: Mon, 20 Jul 2026 11:44:50 +0330 Subject: [PATCH] Fixed v2 mirror --- .../request-management.service.ts | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/request-management/request-management.service.ts b/src/request-management/request-management.service.ts index 68bbcf5..0ab3e95 100644 --- a/src/request-management/request-management.service.ts +++ b/src/request-management/request-management.service.ts @@ -278,6 +278,24 @@ export class RequestManagementService { return; } + // IN_PERSON THIRD_PARTY: guilt is decided on-site by the expert — there is + // no waiting-for-field-expert phase. Replace WAITING_FOR_GUILT_DECISION + // with WAITING_FOR_SIGNATURES wherever it would surface as current/next step. + const isInPersonThirdParty = + req.type === BlameRequestType.THIRD_PARTY && + req.creationMethod === CreationMethod.IN_PERSON && + (req.expertInitiated || req.registrarInitiated); + + const resolveStep = (step: WorkflowStep | undefined): WorkflowStep | undefined => { + if ( + isInPersonThirdParty && + step === WorkflowStep.WAITING_FOR_GUILT_DECISION + ) { + return WorkflowStep.WAITING_FOR_SIGNATURES; + } + return step; + }; + const submittedStep = await this.getWorkflowStep({ stepKey: submittedStepKey, }); @@ -299,8 +317,10 @@ export class RequestManagementService { submittedStep.stepNumber + 1, ); - const nextStepKey = (sequentialNextStep?.stepKey ?? - submittedStep.nextPossibleSteps?.[0]) as WorkflowStep | undefined; + const nextStepKey = resolveStep( + (sequentialNextStep?.stepKey ?? + submittedStep.nextPossibleSteps?.[0]) as WorkflowStep | undefined, + ); if (!nextStepKey) { // Terminal state: no more steps @@ -348,7 +368,7 @@ export class RequestManagementService { nextStepDoc.nextPossibleSteps?.[0]) as WorkflowStep | undefined; req.workflow.currentStep = nextStepKey; - req.workflow.nextStep = afterNextKey; + req.workflow.nextStep = resolveStep(afterNextKey); this.logger.debug( `[WORKFLOW] Advanced to currentStep=${req.workflow.currentStep}, nextStep=${req.workflow.nextStep ?? "undefined"}`,