From 906ff163f16c84246096781b4600534987963ca6 Mon Sep 17 00:00:00 2001 From: sujitaw Date: Mon, 16 Feb 2026 15:53:36 +0530 Subject: [PATCH 01/10] fix/ make changes to invitations table to include data as per ui Signed-off-by: sujitaw --- .../src/ecosystem/ecosystem.controller.ts | 24 +++- .../src/ecosystem/ecosystem.service.ts | 13 +- .../src/platform/platform.controller.ts | 9 +- .../src/platform/platform.service.ts | 11 +- .../interfaces/ecosystem.interfaces.ts | 13 ++ .../repositories/ecosystem.repository.ts | 114 +++++++++++++----- apps/ecosystem/src/ecosystem.controller.ts | 15 ++- apps/ecosystem/src/ecosystem.service.ts | 28 ++++- libs/common/src/response-messages/index.ts | 3 +- libs/prisma-service/prisma/schema.prisma | 5 +- 10 files changed, 188 insertions(+), 47 deletions(-) diff --git a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts index f182e362b..32bd1afbf 100755 --- a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts +++ b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts @@ -813,7 +813,7 @@ export class EcosystemController { description: 'Template details fetched successfully' }) async getTemplateByIntentId( - @Param( + @Param( 'orgId', TrimStringParamPipe, new ParseUUIDPipe({ @@ -944,4 +944,26 @@ export class EcosystemController { data: intent }); } + + @Get('/count/dashboard') + @Roles(OrgRoles.PLATFORM_ADMIN) + @UseGuards(AuthGuard('jwt'), EcosystemRolesGuard) + @ApiBearerAuth() + @ApiOperation({ + summary: 'Get Count for Ecosystem dashboard', + description: 'Get Count for Ecosystem dashboard' + }) + @ApiResponse({ + status: HttpStatus.OK, + description: 'Template details fetched successfully' + }) + async getDashboardCountEcosystem(@Res() res: Response): Promise { + const dashboard = await this.ecosystemService.getDashboardCountEcosystem(); + + return res.status(HttpStatus.OK).json({ + statusCode: HttpStatus.OK, + message: ResponseMessages.ecosystem.success.dashboard, + data: dashboard + }); + } } diff --git a/apps/api-gateway/src/ecosystem/ecosystem.service.ts b/apps/api-gateway/src/ecosystem/ecosystem.service.ts index 57d7e5d0f..520eb8420 100755 --- a/apps/api-gateway/src/ecosystem/ecosystem.service.ts +++ b/apps/api-gateway/src/ecosystem/ecosystem.service.ts @@ -7,7 +7,8 @@ import { IEcosystemDashboard, IEcosystemInvitation, IEcosystemMemberInvitations, - IGetAllOrgs + IGetAllOrgs, + IPlatformDashboardCount } from 'apps/ecosystem/interfaces/ecosystem.interfaces'; import { CreateEcosystemDto } from 'apps/ecosystem/dtos/create-ecosystem-dto'; // eslint-disable-next-line camelcase @@ -40,7 +41,11 @@ export class EcosystemService { * @param userId * @returns All ecosystems from platform */ - async getEcosystems(userId: string, pageDetail: IPaginationSortingDto, orgId:string): Promise> { + async getEcosystems( + userId: string, + pageDetail: IPaginationSortingDto, + orgId: string + ): Promise> { return this.natsClient.sendNatsMessage(this.serviceProxy, 'get-ecosystems', { userId, pageDetail, orgId }); } @@ -229,4 +234,8 @@ export class EcosystemService { userId }); } + + async getDashboardCountEcosystem(): Promise { + return this.natsClient.sendNatsMessage(this.serviceProxy, 'get-dashboard-count-platform-admin', {}); + } } diff --git a/apps/api-gateway/src/platform/platform.controller.ts b/apps/api-gateway/src/platform/platform.controller.ts index a1b860b68..9bb872e6d 100644 --- a/apps/api-gateway/src/platform/platform.controller.ts +++ b/apps/api-gateway/src/platform/platform.controller.ts @@ -36,6 +36,7 @@ import { OrgRolesGuard } from '../authz/guards/org-roles.guard'; import { CreateEcosystemInvitationDto } from '../ecosystem/dtos/send-ecosystem-invitation'; import { EnableEcosystemDto } from '../ecosystem/dtos/enable-ecosystem'; import { EcosystemFeatureGuard } from '../authz/guards/ecosystem-feature-guard'; +import { PaginationDto } from '@credebl/common/dtos/pagination.dto'; @Controller('') @UseFilters(CustomExceptionFilter) @@ -269,8 +270,12 @@ export class PlatformController { @Roles(OrgRoles.PLATFORM_ADMIN) @UseGuards(AuthGuard('jwt'), OrgRolesGuard, EcosystemFeatureGuard) @ApiBearerAuth() - async getInvitations(@User() reqUser: user, @Res() res: Response): Promise { - const invitations = await this.platformService.getInvitationsByUserId(reqUser.id); + async getInvitations( + @User() reqUser: user, + @Res() res: Response, + @Query() pageDto: PaginationDto + ): Promise { + const invitations = await this.platformService.getInvitationsByUserId(reqUser.id, pageDto); return res.status(HttpStatus.OK).json({ statusCode: HttpStatus.OK, diff --git a/apps/api-gateway/src/platform/platform.service.ts b/apps/api-gateway/src/platform/platform.service.ts index 1c6a084c4..ec870b11d 100644 --- a/apps/api-gateway/src/platform/platform.service.ts +++ b/apps/api-gateway/src/platform/platform.service.ts @@ -8,6 +8,7 @@ import { IPlatformCredDefsData } from '@credebl/common/interfaces/cred-def.inter import { NATSClient } from '@credebl/common/NATSClient'; import { ClientProxy } from '@nestjs/microservices'; import { IEcosystemInvitations } from 'apps/ecosystem/interfaces/ecosystem.interfaces'; +import { IPaginationSortingDto, PaginatedResponse } from '@credebl/common/interfaces/interface'; @Injectable() export class PlatformService extends BaseService { @@ -62,8 +63,14 @@ export class PlatformService extends BaseService { * @param userId * @returns Get invitations */ - async getInvitationsByUserId(userId: string): Promise { - return this.natsClient.sendNatsMessage(this.platformServiceProxy, 'get-ecosystem-invitations-by-user', { userId }); + async getInvitationsByUserId( + userId: string, + pageDetail: IPaginationSortingDto + ): Promise> { + return this.natsClient.sendNatsMessage(this.platformServiceProxy, 'get-ecosystem-invitations-by-user', { + userId, + pageDetail + }); } /** diff --git a/apps/ecosystem/interfaces/ecosystem.interfaces.ts b/apps/ecosystem/interfaces/ecosystem.interfaces.ts index 4b795575d..919e62ec7 100755 --- a/apps/ecosystem/interfaces/ecosystem.interfaces.ts +++ b/apps/ecosystem/interfaces/ecosystem.interfaces.ts @@ -70,6 +70,7 @@ export interface IEcosystemInvitations { createdBy: string; organization?: IEcosystemOrg; invitedOrg?: string; + orgStatus?: string; } export interface IEcosystemOrg { @@ -201,6 +202,18 @@ export interface IGetAllOrgUser { username: string | null; } +export interface IGetEcosystemOrgStatus { + ecosystemId: string; + orgId: string; + status: string; +} + export type EcosystemInvitationRoles = OrgRoles.ECOSYSTEM_LEAD | OrgRoles.ECOSYSTEM_MEMBER; export type PrismaExecutor = Prisma.TransactionClient | PrismaClient; + +export interface IPlatformDashboardCount { + ecosystem: number; + invitations: number; + activeOrgs: number; +} diff --git a/apps/ecosystem/repositories/ecosystem.repository.ts b/apps/ecosystem/repositories/ecosystem.repository.ts index a2a817023..1a99de435 100755 --- a/apps/ecosystem/repositories/ecosystem.repository.ts +++ b/apps/ecosystem/repositories/ecosystem.repository.ts @@ -14,6 +14,8 @@ import { IEcosystemDashboard, IEcosystemInvitation, IGetAllOrgs, + IGetEcosystemOrgStatus, + IPlatformDashboardCount, PrismaExecutor } from '../interfaces/ecosystem.interfaces'; import { @@ -93,41 +95,51 @@ export class EcosystemRepository { } async getInvitationsByUserId( - userId: string + userId: string, + pageDetail: IPaginationSortingDto // eslint-disable-next-line camelcase - ): Promise { + ): Promise> { try { - return await this.prisma.ecosystem_invitations.findMany({ - where: { - createdBy: userId - }, - include: { - ecosystem: { - select: { - id: true, - name: true, - description: true, - createDateTime: true + const whereClause = { + createdBy: userId + }; + const [data, count] = await this.prisma.$transaction([ + this.prisma.ecosystem_invitations.findMany({ + where: whereClause, + include: { + ecosystem: { + select: { + id: true, + name: true, + description: true, + createDateTime: true + } + }, + user: { + select: { + id: true, + firstName: true, + lastName: true, + email: true + } + }, + organisation: { + select: { + name: true + } } }, - user: { - select: { - id: true, - firstName: true, - lastName: true, - email: true - } + orderBy: { + createDateTime: 'desc' }, - organisation: { - select: { - name: true - } - } - }, - orderBy: { - createDateTime: 'desc' - } - }); + take: pageDetail.pageSize, + skip: (pageDetail.pageNumber - 1) * pageDetail.pageSize + }), + + this.prisma.ecosystem_invitations.count({ where: whereClause }) + ]); + const totalPages = Math.ceil(count / pageDetail.pageSize); + return { totalPages, data }; } catch (error) { this.logger.error('getInvitationsByUserId error', error); throw new InternalServerErrorException(ResponseMessages.ecosystem.error.fetchInvitationsFailed); @@ -1491,4 +1503,46 @@ export class EcosystemRepository { throw error; } } + + getEcosystemOrgsByOrgIdAndEcosystemId(orgId: string[], ecosystemId: string[]): Promise { + try { + return this.prisma.ecosystem_orgs.findMany({ + where: { + orgId: { in: orgId }, + ecosystemId: { in: ecosystemId } + }, + select: { + orgId: true, + ecosystemId: true, + status: true + } + }); + } catch (error) { + this.logger.error(`getEcosystemOrgsByOrgIdAndEcosystemId error: ${error}`); + throw error; + } + } + + async getDashBoardCountPlatfromAdmin(): Promise { + try { + const data = await this.prisma.$transaction([ + this.prisma.ecosystem.count(), + this.prisma.ecosystem_invitations.count({ + where: { + type: InviteType.ECOSYSTEM + } + }), + this.prisma.ecosystem_orgs.count({ + where: { + status: EcosystemOrgStatus.ACTIVE + } + }) + ]); + const [ecosystem, invitations, activeOrgs] = data; + return { ecosystem, invitations, activeOrgs }; + } catch (error) { + this.logger.error(`getDashBoardCountPlatfromAdmin error: ${error}`); + throw error; + } + } } diff --git a/apps/ecosystem/src/ecosystem.controller.ts b/apps/ecosystem/src/ecosystem.controller.ts index 8a6910421..d356cb306 100755 --- a/apps/ecosystem/src/ecosystem.controller.ts +++ b/apps/ecosystem/src/ecosystem.controller.ts @@ -7,7 +7,8 @@ import { IEcosystemInvitation, IEcosystemInvitations, IEcosystemMemberInvitations, - IGetAllOrgs + IGetAllOrgs, + IPlatformDashboardCount } from '../interfaces/ecosystem.interfaces'; import { IIntentTemplateList, @@ -47,8 +48,11 @@ export class EcosystemController { * @returns List of ecosystem invitations */ @MessagePattern({ cmd: 'get-ecosystem-invitations-by-user' }) - async getInvitationsByUserId(payload: { userId: string }): Promise { - return this.ecosystemService.getInvitationsByUserId(payload.userId); + async getInvitationsByUserId(payload: { + userId: string; + pageDetail: IPaginationSortingDto; + }): Promise> { + return this.ecosystemService.getInvitationsByUserId(payload.userId, payload.pageDetail); } /** @@ -325,4 +329,9 @@ export class EcosystemController { }): Promise<{ message: string }> { return this.ecosystemService.updateEcosystemConfig(payload); } + + @MessagePattern({ cmd: 'get-dashboard-count-platform-admin' }) + async getDashboardCountEcosystem(): Promise { + return this.ecosystemService.getDashboardCountEcosystem(); + } } diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index 464835180..af4c14114 100755 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -33,7 +33,8 @@ import { IEcosystemInvitation, IEcosystemInvitations, IEcosystemMemberInvitations, - IGetAllOrgs + IGetAllOrgs, + IPlatformDashboardCount } from 'apps/ecosystem/interfaces/ecosystem.interfaces'; import { IIntentTemplateList, @@ -156,13 +157,28 @@ export class EcosystemService { return userData; } - async getInvitationsByUserId(userId: string): Promise { + async getInvitationsByUserId( + userId: string, + pageDetail: IPaginationSortingDto + ): Promise> { if (!userId) { throw new BadRequestException('userId missing'); } try { - return await this.ecosystemRepository.getInvitationsByUserId(userId); + const invitations = await this.ecosystemRepository.getInvitationsByUserId(userId, pageDetail); + if (!invitations.data) { + throw new Error('failed to fetch invitations'); + } + const invitedOrgIds = [...new Set(invitations?.data.map((i) => i.invitedOrg).filter(Boolean))]; + const ecosystemIds = [...new Set(invitations?.data.map((i) => i.ecosystemId).filter(Boolean))]; + const orgs = await this.ecosystemRepository.getEcosystemOrgsByOrgIdAndEcosystemId(invitedOrgIds, ecosystemIds); + const statusMap = new Map(orgs.map((org) => [`${org.orgId}-${org.ecosystemId}`, org.status])); + const enrichedData: IEcosystemInvitations[] = invitations.data.map((invitation) => ({ + ...invitation, + orgStatus: statusMap.get(`${invitation.invitedOrg}-${invitation.ecosystemId}`) || 'NOT_FOUND' + })); + return { ...invitations, data: enrichedData }; } catch (error) { this.logger.error('getInvitationsByUserId error', error); throw new InternalServerErrorException(ResponseMessages.ecosystem.error.invitationNotFound); @@ -391,8 +407,8 @@ export class EcosystemService { throw new BadRequestException(ResponseMessages.ecosystem.error.alreadyAccepted); } const result = await this.ecosystemRepository.updateEcosystemInvitationStatusByEmail( - orgId, userEmail, + orgId, ecosystemId, status ); @@ -850,4 +866,8 @@ export class EcosystemService { message: ResponseMessages.ecosystem.success.updateEcosystemConfig }; } + + async getDashboardCountEcosystem(): Promise { + return this.ecosystemRepository.getDashBoardCountPlatfromAdmin(); + } } diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index db9e5d9ca..0933cc2ae 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -198,7 +198,8 @@ export const ResponseMessages = { fetchIntents: 'Ecosystem intents fetched successfully', fetchIntentTemplates: 'Ecosystem intent templates fetched successfully', fetchVerificationTemplates: 'Verification templates fetched successfully', - updateEcosystemConfig: 'Ecosystem configuration updated successfully' + updateEcosystemConfig: 'Ecosystem configuration updated successfully', + dashboard: 'Dashboard data for ecosystem fetched successfully' }, error: { featureIsDisabled: `You don't have access to this feature`, diff --git a/libs/prisma-service/prisma/schema.prisma b/libs/prisma-service/prisma/schema.prisma index 072f87a02..1c0a912d6 100755 --- a/libs/prisma-service/prisma/schema.prisma +++ b/libs/prisma-service/prisma/schema.prisma @@ -779,7 +779,7 @@ model ecosystem_orgs { lastChangedDateTime DateTime @default(now()) @db.Timestamptz(6) lastChangedBy String @db.Uuid deletedAt DateTime? @db.Timestamp(6) - userId String @db.Uuid + userId String @db.Uuid ecosystem ecosystem @relation(fields: [ecosystemId], references: [id]) ecosystemRole ecosystem_roles @relation(fields: [ecosystemRoleId], references: [id]) organisation organisation @relation(fields: [orgId], references: [id]) @@ -804,7 +804,8 @@ model ecosystem_invitations { organisation organisation? @relation(fields: [invitedOrg], references: [id]) ecosystem ecosystem? @relation(fields: [ecosystemId], references: [id]) - user user? @relation(fields: [userId], references: [id]) + user user? @relation(fields: [userId], references: [id]) + @@unique([email, ecosystemId, invitedOrg]) } From 7c9891ded7be3a84868713bb6387594cf4c45615 Mon Sep 17 00:00:00 2001 From: sujitaw Date: Tue, 17 Feb 2026 11:26:00 +0530 Subject: [PATCH 02/10] feat/add api for fetch ecosystem status Signed-off-by: sujitaw --- .../src/platform/platform.controller.ts | 23 +++++++++++++++++++ .../src/platform/platform.service.ts | 4 ++++ .../repositories/ecosystem.repository.ts | 12 ++++++++++ apps/ecosystem/src/ecosystem.controller.ts | 5 ++++ apps/ecosystem/src/ecosystem.service.ts | 4 ++++ libs/common/src/response-messages/index.ts | 3 ++- 6 files changed, 50 insertions(+), 1 deletion(-) diff --git a/apps/api-gateway/src/platform/platform.controller.ts b/apps/api-gateway/src/platform/platform.controller.ts index 9bb872e6d..549a2833e 100644 --- a/apps/api-gateway/src/platform/platform.controller.ts +++ b/apps/api-gateway/src/platform/platform.controller.ts @@ -37,6 +37,7 @@ import { CreateEcosystemInvitationDto } from '../ecosystem/dtos/send-ecosystem-i import { EnableEcosystemDto } from '../ecosystem/dtos/enable-ecosystem'; import { EcosystemFeatureGuard } from '../authz/guards/ecosystem-feature-guard'; import { PaginationDto } from '@credebl/common/dtos/pagination.dto'; +import { EcosystemRolesGuard } from '../authz/guards/ecosystem-roles.guard'; @Controller('') @UseFilters(CustomExceptionFilter) @@ -313,4 +314,26 @@ export class PlatformController { }; return res.status(HttpStatus.OK).json(finalResponse); } + + @Get('/ecosystem-status') + @ApiOperation({ + summary: 'Get ecosystem enabled/disabled status', + description: 'Get ecosystem enabled/disabled status' + }) + @ApiResponse({ + status: HttpStatus.OK, + description: 'Ecosystem status fetched successfully' + }) + @Roles(OrgRoles.PLATFORM_ADMIN) + @UseGuards(AuthGuard('jwt'), EcosystemRolesGuard) + @ApiBearerAuth() + async getEcosystemEnableStatus(@Res() res: Response): Promise { + const ecosystemStatus = await this.platformService.getEcosystemEnableStatus(); + + return res.status(HttpStatus.OK).json({ + statusCode: HttpStatus.OK, + message: ResponseMessages.ecosystem.success.ecosystemStatus, + data: ecosystemStatus + }); + } } diff --git a/apps/api-gateway/src/platform/platform.service.ts b/apps/api-gateway/src/platform/platform.service.ts index ec870b11d..a2cbfbb8a 100644 --- a/apps/api-gateway/src/platform/platform.service.ts +++ b/apps/api-gateway/src/platform/platform.service.ts @@ -82,4 +82,8 @@ export class PlatformService extends BaseService { platformAdminId }); } + + async getEcosystemEnableStatus(): Promise { + return this.natsClient.sendNatsMessage(this.platformServiceProxy, 'get-ecosystem-enable-status', {}); + } } diff --git a/apps/ecosystem/repositories/ecosystem.repository.ts b/apps/ecosystem/repositories/ecosystem.repository.ts index 1a99de435..7c9ee2a2d 100755 --- a/apps/ecosystem/repositories/ecosystem.repository.ts +++ b/apps/ecosystem/repositories/ecosystem.repository.ts @@ -1545,4 +1545,16 @@ export class EcosystemRepository { throw error; } } + + async getEcosystemEnableStatus(): Promise { + try { + const data = await this.prisma.platform_config.findFirst({ + select: { isEcosystemEnabled: true } + }); + return data.isEcosystemEnabled ? data.isEcosystemEnabled : false; + } catch (error) { + this.logger.error(`getEcosystemEnableStatus error: ${error}`); + throw error; + } + } } diff --git a/apps/ecosystem/src/ecosystem.controller.ts b/apps/ecosystem/src/ecosystem.controller.ts index d356cb306..ec0bc1067 100755 --- a/apps/ecosystem/src/ecosystem.controller.ts +++ b/apps/ecosystem/src/ecosystem.controller.ts @@ -334,4 +334,9 @@ export class EcosystemController { async getDashboardCountEcosystem(): Promise { return this.ecosystemService.getDashboardCountEcosystem(); } + + @MessagePattern({ cmd: 'get-ecosystem-enable-status' }) + async getEcosystemEnableStatus(): Promise { + return this.ecosystemService.getEcosystemEnableStatus(); + } } diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index af4c14114..1b033b684 100755 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -870,4 +870,8 @@ export class EcosystemService { async getDashboardCountEcosystem(): Promise { return this.ecosystemRepository.getDashBoardCountPlatfromAdmin(); } + + async getEcosystemEnableStatus(): Promise { + return this.ecosystemRepository.getEcosystemEnableStatus(); + } } diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index 0933cc2ae..7695b9f5c 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -199,7 +199,8 @@ export const ResponseMessages = { fetchIntentTemplates: 'Ecosystem intent templates fetched successfully', fetchVerificationTemplates: 'Verification templates fetched successfully', updateEcosystemConfig: 'Ecosystem configuration updated successfully', - dashboard: 'Dashboard data for ecosystem fetched successfully' + dashboard: 'Dashboard data for ecosystem fetched successfully', + ecosystemStatus: 'Ecosystem status fetched successfully' }, error: { featureIsDisabled: `You don't have access to this feature`, From 29c70d5faa50ca3c72a0b4f56a6673157eebfe54 Mon Sep 17 00:00:00 2001 From: sujitaw Date: Wed, 18 Feb 2026 12:00:05 +0530 Subject: [PATCH 03/10] fix/minor change Signed-off-by: sujitaw --- apps/ecosystem/repositories/ecosystem.repository.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/apps/ecosystem/repositories/ecosystem.repository.ts b/apps/ecosystem/repositories/ecosystem.repository.ts index 7c9ee2a2d..7a4609be8 100755 --- a/apps/ecosystem/repositories/ecosystem.repository.ts +++ b/apps/ecosystem/repositories/ecosystem.repository.ts @@ -115,14 +115,6 @@ export class EcosystemRepository { createDateTime: true } }, - user: { - select: { - id: true, - firstName: true, - lastName: true, - email: true - } - }, organisation: { select: { name: true From 55a39a835a9488108023cf042f7a483528248827 Mon Sep 17 00:00:00 2001 From: sujitaw Date: Wed, 18 Feb 2026 12:27:08 +0530 Subject: [PATCH 04/10] fix/code rabbit comments Signed-off-by: sujitaw --- .../src/ecosystem/ecosystem.controller.ts | 2 +- .../ecosystem/repositories/ecosystem.repository.ts | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts index 32bd1afbf..9bd4e1b41 100755 --- a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts +++ b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts @@ -955,7 +955,7 @@ export class EcosystemController { }) @ApiResponse({ status: HttpStatus.OK, - description: 'Template details fetched successfully' + description: 'Dashboard count fetched successfully' }) async getDashboardCountEcosystem(@Res() res: Response): Promise { const dashboard = await this.ecosystemService.getDashboardCountEcosystem(); diff --git a/apps/ecosystem/repositories/ecosystem.repository.ts b/apps/ecosystem/repositories/ecosystem.repository.ts index 7a4609be8..14fba9e5a 100755 --- a/apps/ecosystem/repositories/ecosystem.repository.ts +++ b/apps/ecosystem/repositories/ecosystem.repository.ts @@ -101,7 +101,8 @@ export class EcosystemRepository { ): Promise> { try { const whereClause = { - createdBy: userId + createdBy: userId, + deletedAt: null }; const [data, count] = await this.prisma.$transaction([ this.prisma.ecosystem_invitations.findMany({ @@ -1496,9 +1497,12 @@ export class EcosystemRepository { } } - getEcosystemOrgsByOrgIdAndEcosystemId(orgId: string[], ecosystemId: string[]): Promise { + async getEcosystemOrgsByOrgIdAndEcosystemId( + orgId: string[], + ecosystemId: string[] + ): Promise { try { - return this.prisma.ecosystem_orgs.findMany({ + return await this.prisma.ecosystem_orgs.findMany({ where: { orgId: { in: orgId }, ecosystemId: { in: ecosystemId } @@ -1518,7 +1522,7 @@ export class EcosystemRepository { async getDashBoardCountPlatfromAdmin(): Promise { try { const data = await this.prisma.$transaction([ - this.prisma.ecosystem.count(), + this.prisma.ecosystem.count({ where: { deletedAt: null } }), this.prisma.ecosystem_invitations.count({ where: { type: InviteType.ECOSYSTEM @@ -1543,7 +1547,7 @@ export class EcosystemRepository { const data = await this.prisma.platform_config.findFirst({ select: { isEcosystemEnabled: true } }); - return data.isEcosystemEnabled ? data.isEcosystemEnabled : false; + return data?.isEcosystemEnabled ?? false; } catch (error) { this.logger.error(`getEcosystemEnableStatus error: ${error}`); throw error; From 1aadc5e1d3d17d7b9b1b86ce7ae5c2bef1b6849e Mon Sep 17 00:00:00 2001 From: sujitaw Date: Wed, 18 Feb 2026 12:44:02 +0530 Subject: [PATCH 05/10] fix/code rabbit comments Signed-off-by: sujitaw --- apps/ecosystem/repositories/ecosystem.repository.ts | 10 ++++++---- apps/ecosystem/src/ecosystem.service.ts | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/ecosystem/repositories/ecosystem.repository.ts b/apps/ecosystem/repositories/ecosystem.repository.ts index 14fba9e5a..012c4b01b 100755 --- a/apps/ecosystem/repositories/ecosystem.repository.ts +++ b/apps/ecosystem/repositories/ecosystem.repository.ts @@ -1519,25 +1519,27 @@ export class EcosystemRepository { } } - async getDashBoardCountPlatfromAdmin(): Promise { + async getDashBoardCountPlatformAdmin(): Promise { try { const data = await this.prisma.$transaction([ this.prisma.ecosystem.count({ where: { deletedAt: null } }), this.prisma.ecosystem_invitations.count({ where: { - type: InviteType.ECOSYSTEM + type: InviteType.ECOSYSTEM, + deletedAt: null } }), this.prisma.ecosystem_orgs.count({ where: { - status: EcosystemOrgStatus.ACTIVE + status: EcosystemOrgStatus.ACTIVE, + deletedAt: null } }) ]); const [ecosystem, invitations, activeOrgs] = data; return { ecosystem, invitations, activeOrgs }; } catch (error) { - this.logger.error(`getDashBoardCountPlatfromAdmin error: ${error}`); + this.logger.error(`getDashBoardCountPlatformAdmin error: ${error}`); throw error; } } diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index 1b033b684..9d8aa363b 100755 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -868,7 +868,7 @@ export class EcosystemService { } async getDashboardCountEcosystem(): Promise { - return this.ecosystemRepository.getDashBoardCountPlatfromAdmin(); + return this.ecosystemRepository.getDashBoardCountPlatformAdmin(); } async getEcosystemEnableStatus(): Promise { From f9e76ffcfd5891266f85080a6f5d1cb3fddeac0f Mon Sep 17 00:00:00 2001 From: sujitaw Date: Wed, 18 Feb 2026 13:08:15 +0530 Subject: [PATCH 06/10] fix/code rabbit issues Signed-off-by: sujitaw --- apps/ecosystem/repositories/ecosystem.repository.ts | 3 ++- apps/ecosystem/src/ecosystem.service.ts | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/ecosystem/repositories/ecosystem.repository.ts b/apps/ecosystem/repositories/ecosystem.repository.ts index 012c4b01b..afdb47954 100755 --- a/apps/ecosystem/repositories/ecosystem.repository.ts +++ b/apps/ecosystem/repositories/ecosystem.repository.ts @@ -1505,7 +1505,8 @@ export class EcosystemRepository { return await this.prisma.ecosystem_orgs.findMany({ where: { orgId: { in: orgId }, - ecosystemId: { in: ecosystemId } + ecosystemId: { in: ecosystemId }, + deletedAt: null }, select: { orgId: true, diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index 9d8aa363b..a280ae25e 100755 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -167,9 +167,6 @@ export class EcosystemService { try { const invitations = await this.ecosystemRepository.getInvitationsByUserId(userId, pageDetail); - if (!invitations.data) { - throw new Error('failed to fetch invitations'); - } const invitedOrgIds = [...new Set(invitations?.data.map((i) => i.invitedOrg).filter(Boolean))]; const ecosystemIds = [...new Set(invitations?.data.map((i) => i.ecosystemId).filter(Boolean))]; const orgs = await this.ecosystemRepository.getEcosystemOrgsByOrgIdAndEcosystemId(invitedOrgIds, ecosystemIds); From d92a3beee0c36db9787ad88570f58a6d384edbf3 Mon Sep 17 00:00:00 2001 From: sujitaw Date: Wed, 18 Feb 2026 13:16:09 +0530 Subject: [PATCH 07/10] fix/code rabbit comments Signed-off-by: sujitaw --- apps/ecosystem/src/ecosystem.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index a280ae25e..bae0bfdd9 100755 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -167,8 +167,8 @@ export class EcosystemService { try { const invitations = await this.ecosystemRepository.getInvitationsByUserId(userId, pageDetail); - const invitedOrgIds = [...new Set(invitations?.data.map((i) => i.invitedOrg).filter(Boolean))]; - const ecosystemIds = [...new Set(invitations?.data.map((i) => i.ecosystemId).filter(Boolean))]; + const invitedOrgIds = [...new Set(invitations.data.map((i) => i.invitedOrg).filter(Boolean))]; + const ecosystemIds = [...new Set(invitations.data.map((i) => i.ecosystemId).filter(Boolean))]; const orgs = await this.ecosystemRepository.getEcosystemOrgsByOrgIdAndEcosystemId(invitedOrgIds, ecosystemIds); const statusMap = new Map(orgs.map((org) => [`${org.orgId}-${org.ecosystemId}`, org.status])); const enrichedData: IEcosystemInvitations[] = invitations.data.map((invitation) => ({ From 5717a2abf50515e905c771436c85457f60710545 Mon Sep 17 00:00:00 2001 From: sujitaw Date: Wed, 18 Feb 2026 13:39:02 +0530 Subject: [PATCH 08/10] fix/naming of api Signed-off-by: sujitaw --- apps/api-gateway/src/ecosystem/ecosystem.controller.ts | 2 +- apps/api-gateway/src/platform/platform.controller.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts index 9bd4e1b41..9383cd857 100755 --- a/apps/api-gateway/src/ecosystem/ecosystem.controller.ts +++ b/apps/api-gateway/src/ecosystem/ecosystem.controller.ts @@ -945,7 +945,7 @@ export class EcosystemController { }); } - @Get('/count/dashboard') + @Get('/dashboard/summary') @Roles(OrgRoles.PLATFORM_ADMIN) @UseGuards(AuthGuard('jwt'), EcosystemRolesGuard) @ApiBearerAuth() diff --git a/apps/api-gateway/src/platform/platform.controller.ts b/apps/api-gateway/src/platform/platform.controller.ts index 549a2833e..4cc39c3c8 100644 --- a/apps/api-gateway/src/platform/platform.controller.ts +++ b/apps/api-gateway/src/platform/platform.controller.ts @@ -315,7 +315,7 @@ export class PlatformController { return res.status(HttpStatus.OK).json(finalResponse); } - @Get('/ecosystem-status') + @Get('/ecosystem/status') @ApiOperation({ summary: 'Get ecosystem enabled/disabled status', description: 'Get ecosystem enabled/disabled status' From c34737d18fec1371a43db1651d7c0e1e3a622c6c Mon Sep 17 00:00:00 2001 From: sujitaw Date: Wed, 18 Feb 2026 15:55:40 +0530 Subject: [PATCH 09/10] fix/pr comments Signed-off-by: sujitaw --- apps/ecosystem/src/ecosystem.service.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/apps/ecosystem/src/ecosystem.service.ts b/apps/ecosystem/src/ecosystem.service.ts index bae0bfdd9..145193226 100755 --- a/apps/ecosystem/src/ecosystem.service.ts +++ b/apps/ecosystem/src/ecosystem.service.ts @@ -167,15 +167,7 @@ export class EcosystemService { try { const invitations = await this.ecosystemRepository.getInvitationsByUserId(userId, pageDetail); - const invitedOrgIds = [...new Set(invitations.data.map((i) => i.invitedOrg).filter(Boolean))]; - const ecosystemIds = [...new Set(invitations.data.map((i) => i.ecosystemId).filter(Boolean))]; - const orgs = await this.ecosystemRepository.getEcosystemOrgsByOrgIdAndEcosystemId(invitedOrgIds, ecosystemIds); - const statusMap = new Map(orgs.map((org) => [`${org.orgId}-${org.ecosystemId}`, org.status])); - const enrichedData: IEcosystemInvitations[] = invitations.data.map((invitation) => ({ - ...invitation, - orgStatus: statusMap.get(`${invitation.invitedOrg}-${invitation.ecosystemId}`) || 'NOT_FOUND' - })); - return { ...invitations, data: enrichedData }; + return invitations; } catch (error) { this.logger.error('getInvitationsByUserId error', error); throw new InternalServerErrorException(ResponseMessages.ecosystem.error.invitationNotFound); From 45fe4f342a137077ef86b7e0c7a5cb52a9ef9b52 Mon Sep 17 00:00:00 2001 From: sujitaw Date: Wed, 18 Feb 2026 16:00:18 +0530 Subject: [PATCH 10/10] fix/pr comments Signed-off-by: sujitaw --- apps/api-gateway/src/ecosystem/ecosystem.service.ts | 2 +- apps/ecosystem/src/ecosystem.controller.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api-gateway/src/ecosystem/ecosystem.service.ts b/apps/api-gateway/src/ecosystem/ecosystem.service.ts index 520eb8420..26c9e4ac9 100755 --- a/apps/api-gateway/src/ecosystem/ecosystem.service.ts +++ b/apps/api-gateway/src/ecosystem/ecosystem.service.ts @@ -236,6 +236,6 @@ export class EcosystemService { } async getDashboardCountEcosystem(): Promise { - return this.natsClient.sendNatsMessage(this.serviceProxy, 'get-dashboard-count-platform-admin', {}); + return this.natsClient.sendNatsMessage(this.serviceProxy, 'get-platform-admin-dashboard-count', {}); } } diff --git a/apps/ecosystem/src/ecosystem.controller.ts b/apps/ecosystem/src/ecosystem.controller.ts index ec0bc1067..121739dbc 100755 --- a/apps/ecosystem/src/ecosystem.controller.ts +++ b/apps/ecosystem/src/ecosystem.controller.ts @@ -330,7 +330,7 @@ export class EcosystemController { return this.ecosystemService.updateEcosystemConfig(payload); } - @MessagePattern({ cmd: 'get-dashboard-count-platform-admin' }) + @MessagePattern({ cmd: 'get-platform-admin-dashboard-count' }) async getDashboardCountEcosystem(): Promise { return this.ecosystemService.getDashboardCountEcosystem(); }