Skip to content

Commit

Permalink
Merge branch 'approval-workflows/transforming-data' into approval-wor…
Browse files Browse the repository at this point in the history
…kflows/onyx-setup
  • Loading branch information
blazejkustra committed Jul 26, 2024
2 parents 021b8ce + a23e4fe commit 91074a4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
11 changes: 11 additions & 0 deletions src/libs/WorkflowUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
15 changes: 10 additions & 5 deletions src/types/onyx/ApprovalWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
/**
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 91074a4

Please sign in to comment.