Skip to content

Commit

Permalink
refactor: ecosystem lead details included ecosystem dashboard (#156)
Browse files Browse the repository at this point in the history
* worked on the ecosystem lead details

Signed-off-by: Nishad <nishad.shirsat@ayanworks.com>

* removed the unnecessary code and comments

Signed-off-by: Nishad <nishad.shirsat@ayanworks.com>

---------

Signed-off-by: Nishad <nishad.shirsat@ayanworks.com>
Signed-off-by: KulkarniShashank <shashank.kulkarni@ayanworks.com>
  • Loading branch information
nishad-ayanworks authored and KulkarniShashank committed Sep 11, 2024
1 parent 2d1153a commit 79b831b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
7 changes: 1 addition & 6 deletions apps/ecosystem/src/ecosystem.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,7 @@ export class EcosystemRepository {
}
}

/**
*
* @returns Get ecosystem dashboard card count
*/
// eslint-disable-next-line camelcase
async getEcosystemDashboardDetails(ecosystemId: string): Promise<{ membersCount: number; endorsementsCount: number; ecosystemConfigData: ecosystem_config[] }> {
async getEcosystemDashboardDetails(ecosystemId: string): Promise<{membersCount: number; endorsementsCount: number}> {
try {
const membersCount = await this.getEcosystemMembersCount(ecosystemId);
const endorsementsCount = await this.getEcosystemEndorsementsCount(ecosystemId);
Expand Down
25 changes: 24 additions & 1 deletion apps/ecosystem/src/ecosystem.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,30 @@ export class EcosystemService {
*/
async getEcosystemDashboardDetails(ecosystemId: string): Promise<object> {
try {
return await this.ecosystemRepository.getEcosystemDashboardDetails(ecosystemId);
const endorseMemberCount = await this.ecosystemRepository.getEcosystemDashboardDetails(ecosystemId);

const query = {
ecosystemId,
ecosystemRole: {
name: EcosystemRoles.ECOSYSTEM_LEAD
}
};

const ecosystemDetails = await this.ecosystemRepository.fetchEcosystemOrg(
query
);

const dashboardDetails = {
ecosystem: ecosystemDetails['ecosystem'],
membersCount: endorseMemberCount.membersCount,
endorsementsCount: endorseMemberCount.endorsementsCount,
ecosystemLead:{
role: ecosystemDetails['ecosystemRole']['name'],
orgName: ecosystemDetails['orgName']
}
};

return dashboardDetails;
} catch (error) {
this.logger.error(`In ecosystem dashboard details : ${JSON.stringify(error)}`);
throw new RpcException(error.response ? error.response : error);
Expand Down

0 comments on commit 79b831b

Please sign in to comment.