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
22 changes: 0 additions & 22 deletions apps/api-gateway/src/ecosystem/ecosystem.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,28 +442,6 @@ export class EcosystemController {
});
}

@Get('/dashboard/summary')
@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: 'Dashboard count fetched successfully'
})
async getDashboardCountEcosystem(@Res() res: Response): Promise<Response> {
const dashboard = await this.ecosystemService.getDashboardCountEcosystem();

return res.status(HttpStatus.OK).json({
statusCode: HttpStatus.OK,
message: ResponseMessages.ecosystem.success.dashboard,
data: dashboard
});
}

@Get('/invitation/status')
@UseGuards(AuthGuard('jwt'))
@ApiBearerAuth()
Expand Down
22 changes: 22 additions & 0 deletions apps/api-gateway/src/platform/platform.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,26 @@ export class PlatformController {
data: ecosystemStatus
});
}

@Get('/ecosystem/dashboard/summary')
@Roles(OrgRoles.PLATFORM_ADMIN)
@UseGuards(AuthGuard('jwt'), EcosystemRolesGuard)
Comment thread
sujitaw marked this conversation as resolved.
@ApiBearerAuth()
@ApiOperation({
summary: 'Get summary for Ecosystem dashboard',
description: 'Get summary for Ecosystem dashboard'
})
@ApiResponse({
status: HttpStatus.OK,
description: 'Dashboard count fetched successfully'
})
async getDashboardCountEcosystem(@Res() res: Response): Promise<Response> {
const dashboard = await this.platformService.getDashboardCountEcosystem();

return res.status(HttpStatus.OK).json({
statusCode: HttpStatus.OK,
message: ResponseMessages.ecosystem.success.dashboard,
data: dashboard
});
}
}
6 changes: 5 additions & 1 deletion apps/api-gateway/src/platform/platform.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { GetAllPlatformCredDefsDto } from '../credential-definition/dto/get-all-
import { IPlatformCredDefsData } from '@credebl/common/interfaces/cred-def.interface';
import { NATSClient } from '@credebl/common/NATSClient';
import { ClientProxy } from '@nestjs/microservices';
import { IEcosystemInvitations } from 'apps/ecosystem/interfaces/ecosystem.interfaces';
import { IEcosystemInvitations, IPlatformDashboardCount } from 'apps/ecosystem/interfaces/ecosystem.interfaces';
import { IPaginationSortingDto, PaginatedResponse } from '@credebl/common/interfaces/interface';

@Injectable()
Expand Down Expand Up @@ -86,4 +86,8 @@ export class PlatformService extends BaseService {
async getEcosystemEnableStatus(): Promise<boolean> {
return this.natsClient.sendNatsMessage(this.platformServiceProxy, 'get-ecosystem-enable-status', {});
}

async getDashboardCountEcosystem(): Promise<IPlatformDashboardCount> {
return this.natsClient.sendNatsMessage(this.platformServiceProxy, 'get-platform-admin-dashboard-count', {});
}
}
6 changes: 5 additions & 1 deletion apps/user/src/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
UnauthorizedException,
InternalServerErrorException,
Inject,
HttpException
HttpException,
ForbiddenException
} from '@nestjs/common';

import { ClientRegistrationService } from '@credebl/client-registration';
Expand Down Expand Up @@ -139,6 +140,9 @@ export class UserService {

const clientDetails = await getCredentialsByAlias(clientAlias);

if (process.env.ADMIN_CLIENT_ALIAS === clientAlias) {
throw new ForbiddenException(ResponseMessages.user.error.adminAlias);
}
try {
const token = await this.clientRegistrationService.getManagementToken(
clientDetails.clientId,
Expand Down
1 change: 1 addition & 0 deletions libs/common/src/response-messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const ResponseMessages = {
error: {
exists: 'User already exists',
profileNotFound: 'User public profile not found',
adminAlias: 'Use of ADMIN alias for user creation is forbidden',
notUpdatePlatformSettings: 'Unable to update platform config settings',
platformSetttingsNotFound: 'Unable to get platform settings',
verificationAlreadySent: 'The verification link has already been sent to your email address',
Expand Down