Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
meetcshah19 committed Sep 23, 2024
1 parent fcbc7fc commit 3a38e1e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions backend/src/ee/routes/v1/access-approval-policy-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const registerAccessApprovalPolicyRouter = async (server: FastifyZodProvi
approvers: z
.object({ type: z.nativeEnum(ApproverType), id: z.string() })
.array()
.min(1),
.min(1, { message: "At least one approver should be provided" }),
approvals: z.number().min(1).default(1),
enforcementLevel: z.nativeEnum(EnforcementLevel).default(EnforcementLevel.Hard)
}),
Expand Down Expand Up @@ -129,7 +129,7 @@ export const registerAccessApprovalPolicyRouter = async (server: FastifyZodProvi
approvers: z
.object({ type: z.nativeEnum(ApproverType), id: z.string() })
.array()
.min(1),
.min(1, { message: "At least one approver should be provided" }),
approvals: z.number().min(1).optional(),
enforcementLevel: z.nativeEnum(EnforcementLevel).default(EnforcementLevel.Hard)
}),
Expand Down
4 changes: 2 additions & 2 deletions backend/src/ee/routes/v1/secret-approval-policy-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const registerSecretApprovalPolicyRouter = async (server: FastifyZodProvi
approvers: z
.object({ type: z.nativeEnum(ApproverType), id: z.string() })
.array()
.min(1),
.min(1, { message: "At least one approver should be provided" }),
approvals: z.number().min(1).default(1),
enforcementLevel: z.nativeEnum(EnforcementLevel).default(EnforcementLevel.Hard)
}),
Expand Down Expand Up @@ -71,7 +71,7 @@ export const registerSecretApprovalPolicyRouter = async (server: FastifyZodProvi
approvers: z
.object({ type: z.nativeEnum(ApproverType), id: z.string() })
.array()
.min(1),
.min(1, { message: "At least one approver should be provided" }),
approvals: z.number().min(1).default(1),
secretPath: z
.string()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ export const secretApprovalRequestServiceFactory = ({
const hasMinApproval =
secretApprovalRequest.policy.approvals <=
secretApprovalRequest.policy.approvers.filter(({ userId: approverId }) =>
approverId ? reviewers[approverId.toString()] === ApprovalStatus.APPROVED : null
approverId ? reviewers[approverId] === ApprovalStatus.APPROVED : false
).length;
const isSoftEnforcement = secretApprovalRequest.policy.enforcementLevel === EnforcementLevel.Soft;

Expand Down

0 comments on commit 3a38e1e

Please sign in to comment.