Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion apps/agent-service/src/agent-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger/src/schema/schema.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down