Skip to content

Commit 91c6deb

Browse files
Update apps/api/src/policies/policies.service.ts
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Signed-off-by: Mariano Fuentes <marfuen98@gmail.com>
1 parent 9718d87 commit 91c6deb

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

apps/api/src/policies/policies.service.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,11 @@ export class PoliciesService {
10301030

10311031
if (!policy.pendingVersionId) {
10321032
if (policy.approverId) {
1033+
if (policy.approverId !== dto.approverId) {
1034+
throw new BadRequestException(
1035+
'Only the assigned approver can accept changes',
1036+
);
1037+
}
10331038
await db.policy.update({
10341039
where: { id: policyId },
10351040
data: { approverId: null },
@@ -1038,6 +1043,7 @@ export class PoliciesService {
10381043
'This policy has no pending changes to approve. The stale approval request has been cleared — please ask the policy owner to re-submit if a new approval is needed.',
10391044
);
10401045
}
1046+
}
10411047
throw new BadRequestException('No pending version to approve');
10421048
}
10431049

0 commit comments

Comments
 (0)