Merge pull request 'Fixed sign' (#207) from s.yahyaee/yara724-api:main into main

Reviewed-on: Yara724/api#207
This commit is contained in:
2026-07-22 15:47:02 +03:30

View File

@@ -2113,10 +2113,6 @@ export class RequestManagementService {
? req.workflow.completedSteps ? req.workflow.completedSteps
: []; : [];
if (!completed.includes(stepKey)) completed.push(stepKey); if (!completed.includes(stepKey)) completed.push(stepKey);
// Same as postfield-expert reply: guilt phase is satisfied without an expert; parties must still sign.
if (!completed.includes(WorkflowStep.WAITING_FOR_GUILT_DECISION)) {
completed.push(WorkflowStep.WAITING_FOR_GUILT_DECISION);
}
req.workflow.completedSteps = completed; req.workflow.completedSteps = completed;
req.workflow.currentStep = WorkflowStep.WAITING_FOR_SIGNATURES; req.workflow.currentStep = WorkflowStep.WAITING_FOR_SIGNATURES;
req.workflow.nextStep = WorkflowStep.WAITING_FOR_SIGNATURES; req.workflow.nextStep = WorkflowStep.WAITING_FOR_SIGNATURES;
@@ -2200,9 +2196,6 @@ export class RequestManagementService {
? req.workflow.completedSteps ? req.workflow.completedSteps
: []; : [];
if (!completed.includes(stepKey)) completed.push(stepKey); if (!completed.includes(stepKey)) completed.push(stepKey);
if (!completed.includes(WorkflowStep.WAITING_FOR_GUILT_DECISION)) {
completed.push(WorkflowStep.WAITING_FOR_GUILT_DECISION);
}
req.workflow.completedSteps = completed; req.workflow.completedSteps = completed;
req.workflow.currentStep = WorkflowStep.WAITING_FOR_SIGNATURES; req.workflow.currentStep = WorkflowStep.WAITING_FOR_SIGNATURES;
req.workflow.nextStep = WorkflowStep.WAITING_FOR_SIGNATURES; req.workflow.nextStep = WorkflowStep.WAITING_FOR_SIGNATURES;
@@ -6836,34 +6829,24 @@ export class RequestManagementService {
}, },
}; };
// For IN_PERSON expert files that have not yet reached COMPLETED: after accident // IN_PERSON V2 mirror: accident-fields is a post-sign supplemental step called
// fields are filled, guilt is decided and we can go straight to signatures. // only after COMPLETED (both parties have signed). Record WAITING_FOR_GUILT_DECISION
// When the file is already COMPLETED (both parties signed) we only save the // in completedSteps here — it was intentionally omitted from description so the
// supplemental fields without touching the workflow or status. // frontend does not route to this page before signatures are collected.
if ( if (req.creationMethod === CreationMethod.IN_PERSON) {
req.creationMethod === CreationMethod.IN_PERSON &&
req.status !== CaseStatus.COMPLETED
) {
const completed = Array.isArray(req.workflow?.completedSteps) const completed = Array.isArray(req.workflow?.completedSteps)
? req.workflow.completedSteps ? req.workflow.completedSteps
: []; : [];
const currentStep = req.workflow?.currentStep as WorkflowStep | undefined;
if (currentStep && !completed.includes(currentStep)) {
completed.push(currentStep);
}
if (!completed.includes(WorkflowStep.WAITING_FOR_GUILT_DECISION)) { if (!completed.includes(WorkflowStep.WAITING_FOR_GUILT_DECISION)) {
completed.push(WorkflowStep.WAITING_FOR_GUILT_DECISION); completed.push(WorkflowStep.WAITING_FOR_GUILT_DECISION);
} }
if (req.workflow) { if (req.workflow) {
req.workflow.completedSteps = completed; req.workflow.completedSteps = completed;
req.workflow.currentStep = WorkflowStep.WAITING_FOR_SIGNATURES;
req.workflow.nextStep = undefined;
} }
req.status = CaseStatus.WAITING_FOR_SIGNATURES;
if (!Array.isArray(req.history)) req.history = []; if (!Array.isArray(req.history)) req.history = [];
req.history.push({ req.history.push({
type: "ACCIDENT_FIELDS_SAVED_ADVANCED_TO_SIGNATURES", type: "ACCIDENT_FIELDS_SAVED",
actor: { actor: {
actorId: new Types.ObjectId(String(expert.sub)), actorId: new Types.ObjectId(String(expert.sub)),
actorName: actorName:
@@ -6872,7 +6855,6 @@ export class RequestManagementService {
}, },
metadata: { metadata: {
accidentWay: fields.accidentWay, accidentWay: fields.accidentWay,
advancedTo: WorkflowStep.WAITING_FOR_SIGNATURES,
}, },
} as any); } as any);
} }