forked from Yara724/api
Fixed v2 flow
This commit is contained in:
@@ -278,6 +278,32 @@ export class RequestManagementService {
|
||||
return;
|
||||
}
|
||||
|
||||
// IN_PERSON THIRD_PARTY (expert/registrar-initiated): after first-party description
|
||||
// the expert collects the first party's signature before moving to the second party.
|
||||
// Skip FIRST_INVITE_SECOND and hold at WAITING_FOR_SIGNATURES so the sign endpoint
|
||||
// can be called for the first party. The workflow advances to FIRST_INVITE_SECOND
|
||||
// only after expertUploadPartySignatureV2/V3 records the first-party confirmation.
|
||||
if (
|
||||
req.type === BlameRequestType.THIRD_PARTY &&
|
||||
req.creationMethod === CreationMethod.IN_PERSON &&
|
||||
(req.expertInitiated || req.registrarInitiated) &&
|
||||
submittedStepKey === WorkflowStep.FIRST_DESCRIPTION
|
||||
) {
|
||||
const completed = Array.isArray(req.workflow.completedSteps)
|
||||
? req.workflow.completedSteps
|
||||
: [];
|
||||
if (!completed.includes(submittedStepKey))
|
||||
completed.push(submittedStepKey);
|
||||
req.workflow.completedSteps = completed;
|
||||
req.workflow.currentStep = WorkflowStep.WAITING_FOR_SIGNATURES;
|
||||
req.workflow.nextStep = undefined;
|
||||
req.status = CaseStatus.WAITING_FOR_SIGNATURES;
|
||||
this.logger.debug(
|
||||
"[WORKFLOW] IN_PERSON THIRD_PARTY: advanced to WAITING_FOR_SIGNATURES after FIRST_DESCRIPTION (first-party sign before second-party invite)",
|
||||
);
|
||||
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.
|
||||
@@ -6728,6 +6754,23 @@ export class RequestManagementService {
|
||||
},
|
||||
});
|
||||
}
|
||||
} else if (
|
||||
// THIRD_PARTY IN_PERSON: first party just signed — advance workflow to
|
||||
// FIRST_INVITE_SECOND so the frontend knows to proceed to the second-party
|
||||
// registration step. Status stays WAITING_FOR_SIGNATURES.
|
||||
req.type === BlameRequestType.THIRD_PARTY &&
|
||||
req.creationMethod === CreationMethod.IN_PERSON &&
|
||||
(req.expertInitiated || req.registrarInitiated) &&
|
||||
partyRole === PartyRole.FIRST
|
||||
) {
|
||||
await this.blameRequestDbService.findByIdAndUpdate(requestId, {
|
||||
$set: {
|
||||
"workflow.currentStep": WorkflowStep.FIRST_INVITE_SECOND as any,
|
||||
"workflow.nextStep": WorkflowStep.SECOND_INITIAL_FORM as any,
|
||||
},
|
||||
});
|
||||
message =
|
||||
"First party signature recorded. Proceed to register the second party.";
|
||||
}
|
||||
return {
|
||||
requestId: String(req._id),
|
||||
|
||||
Reference in New Issue
Block a user