From a23e4fe0a5b622a9ab1fdc61811d1865d0f541fb Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 26 Jul 2024 08:39:19 +0200 Subject: [PATCH] Update the comments according to feedback --- src/libs/WorkflowUtils.ts | 11 +++++++++++ src/types/onyx/ApprovalWorkflow.ts | 15 ++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/libs/WorkflowUtils.ts b/src/libs/WorkflowUtils.ts index a513e006f8fe..6e8fc3322da0 100644 --- a/src/libs/WorkflowUtils.ts +++ b/src/libs/WorkflowUtils.ts @@ -123,8 +123,19 @@ function convertPolicyEmployeesToApprovalWorkflows({employees, defaultApprover, } type ConvertApprovalWorkflowToPolicyEmployeesParams = { + /** + * Approval workflow to convert + */ approvalWorkflow: ApprovalWorkflow; + + /** + * Current list of employees in the policy + */ employeeList: PolicyEmployeeList; + + /** + * Should the workflow be removed from the employees + */ removeWorkflow?: boolean; }; diff --git a/src/types/onyx/ApprovalWorkflow.ts b/src/types/onyx/ApprovalWorkflow.ts index 929876cd0b75..018996000540 100644 --- a/src/types/onyx/ApprovalWorkflow.ts +++ b/src/types/onyx/ApprovalWorkflow.ts @@ -25,18 +25,21 @@ type Approver = { displayName?: string; /** - * Is this approver in more than one workflow + * Is this user used as an approver in more than one workflow (used to show a warning) */ isInMultipleWorkflows: boolean; /** - * Is this approver in a circular reference + * Is this approver in a circular reference (approver forwards to themselves, or a cycle of forwards) + * + * example: A -> A (self forwards) + * example: A -> B -> C -> A (cycle) */ isCircularReference?: boolean; }; /** - * + * Member in the approval workflow */ type Member = { /** @@ -65,12 +68,14 @@ type ApprovalWorkflow = { members: Member[]; /** - * List of approvers in the workflow + * List of approvers in the workflow (the order of approvers in this array is important) + * + * The first approver in the array is the first approver in the workflow, next approver is the one they forward to, etc. */ approvers: Approver[]; /** - * Is this the default workflow + * Is this the default workflow for the policy (first approver of this workflow is the same as the policy's default approver) */ isDefault: boolean;