diff --git a/apps/agent-service/src/agent-service.service.ts b/apps/agent-service/src/agent-service.service.ts index ae092b204..b844083cd 100644 --- a/apps/agent-service/src/agent-service.service.ts +++ b/apps/agent-service/src/agent-service.service.ts @@ -1748,7 +1748,6 @@ export class AgentServiceService { throw new InternalServerErrorException(`Failed to get agent information: ${orgAgentResult.reason}`); } - const getApiKey = getApiKeyResult?.value; const orgAgent = orgAgentResult?.value; const orgAgentTypeResult = await this.agentServiceRepository.getOrgAgentType(orgAgent.orgAgentTypeId); @@ -1757,6 +1756,17 @@ export class AgentServiceService { throw new NotFoundException(ResponseMessages.agent.error.orgAgentNotFound); } + let getApiKey; + if (OrgAgentType.SHARED) { + const platformAdminSpinnedUp = await this.agentServiceRepository.platformAdminAgent( + CommonConstants.PLATFORM_ADMIN_ORG + ); + + getApiKey = await this.commonService.decryptPassword(platformAdminSpinnedUp?.org_agents[0].apiKey); + } else { + getApiKey = getApiKeyResult?.value; + } + // Determine the URL based on the agent type const url = orgAgentTypeResult.agent === OrgAgentType.SHARED diff --git a/apps/ledger/src/schema/schema.service.ts b/apps/ledger/src/schema/schema.service.ts index f3f7bd5a2..1fd599611 100644 --- a/apps/ledger/src/schema/schema.service.ts +++ b/apps/ledger/src/schema/schema.service.ts @@ -649,7 +649,7 @@ export class SchemaService extends BaseService { const response = await this.schemaRepository.getAllSchemaDetails(schemaSearchCriteria); const schemasDetails = response?.schemasResult.map((schemaAttributeItem) => { const attributes = JSON.parse(schemaAttributeItem.attributes); - return { ...schemaAttributeItem, attributes, organizationName: schemaAttributeItem.organisation.name }; + return { ...schemaAttributeItem, attributes, organizationName: schemaAttributeItem.organisation?.name || '' }; }); const schemasResponse = {