Scheduling infrastructure for absolutely everyone.
fix: delegation credential not found (#20055)
Morgan50a76e6b276a
diff --git a/apps/api/v2/src/modules/organizations/delegation-credentials/services/organizations-delegation-credential.service.ts b/apps/api/v2/src/modules/organizations/delegation-credentials/services/organizations-delegation-credential.service.tsindex 1f39ef937de..b42d63e0f93 100644--- a/apps/api/v2/src/modules/organizations/delegation-credentials/services/organizations-delegation-credential.service.ts+++ b/apps/api/v2/src/modules/organizations/delegation-credentials/services/organizations-delegation-credential.service.ts@@ -38,6 +38,15 @@ export class OrganizationsDelegationCredentialService {delegatedServiceAccountUser: User,body: UpdateDelegationCredentialInput) {+ const delegationCredential =+ await this.organizationsDelegationCredentialRepository.findByIdWithWorkspacePlatform(+ delegationCredentialId+ );++ if (!delegationCredential) {+ throw new NotFoundException(`DelegationCredential with id ${delegationCredentialId} not found`);+ }+if (body.enabled !== undefined) {await this.updateDelegationCredentialEnabled(orgId,@@ -49,15 +58,8 @@ export class OrganizationsDelegationCredentialService {if (body.serviceAccountKey !== undefined) {await this.updateDelegationCredentialServiceAccountKey(delegationCredentialId, body.serviceAccountKey);}- const delegationCredential =- await this.organizationsDelegationCredentialRepository.findByIdWithWorkspacePlatform(- delegationCredentialId- );- if (!delegationCredential) {- throw new NotFoundException(`DelegationCredential with id ${delegationCredentialId} not found`);- }- return delegationCredential;+ return { ...delegationCredential, enabled: body?.enabled ?? delegationCredential?.enabled };}async updateDelegationCredentialEnabled(