diff --git a/apps/agent-service/src/agent-service.service.ts b/apps/agent-service/src/agent-service.service.ts index 1fb00b4d6..b76fd1faf 100644 --- a/apps/agent-service/src/agent-service.service.ts +++ b/apps/agent-service/src/agent-service.service.ts @@ -846,6 +846,9 @@ export class AgentServiceService { async getAgentHealthDetails(orgId: number): Promise { try { const orgAgentDetails: org_agents = await this.agentServiceRepository.getOrgAgentDetails(orgId); + if (!orgAgentDetails) { + throw new NotFoundException(ResponseMessages.agent.error.agentNotExists); + } if (orgAgentDetails.agentEndPoint) { const data = await this.commonService .httpGet(`${orgAgentDetails.agentEndPoint}/agent`, { headers: { 'x-api-key': '' } }) @@ -857,6 +860,7 @@ export class AgentServiceService { } catch (error) { this.logger.error(`Agent health details : ${JSON.stringify(error)}`); + throw new RpcException(error); } } } diff --git a/apps/ledger/src/schema/repositories/schema.repository.ts b/apps/ledger/src/schema/repositories/schema.repository.ts index abb7eb4a3..235c0aa62 100644 --- a/apps/ledger/src/schema/repositories/schema.repository.ts +++ b/apps/ledger/src/schema/repositories/schema.repository.ts @@ -112,7 +112,9 @@ export class SchemaRepository { }); const schemasCount = await this.prisma.schema.count({ where: { - orgId + organisation: { + id: orgId + } } }); return {schemasCount, schemasResult}; diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index 166416fdb..7cd59c48f 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -123,7 +123,8 @@ export const ResponseMessages = { apiEndpointNotFound: 'apiEndpoint not found', notAbleToSpinUpAgent: 'Agent not able to spin-up', alreadySpinUp: 'Agent already spin-up', - agentUrl: 'Agent url not exist' + agentUrl: 'Agent url not exist', + agentNotExists: 'Agent not spinned up for this organization' } }, connection: {