Skip to content

Commit 63756fe

Browse files
Merge pull request #1094 from credebl/develop-dco-fixed
Sync changes from DEV to QA.
2 parents 75e5745 + 337fdf0 commit 63756fe

File tree

24 files changed

+474
-220
lines changed

24 files changed

+474
-220
lines changed

.env.demo

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ AFJ_AGENT_ENDPOINT_PATH=/agent-provisioning/AFJ/endpoints/
126126

127127
AGENT_PROTOCOL=http
128128
OOB_BATCH_SIZE=10
129+
PROOF_REQ_CONN_LIMIT=10
129130
MAX_ORG_LIMIT=10
130131
FIDO_API_ENDPOINT=http://localhost:8000
131132

@@ -135,4 +136,8 @@ ELK_LOG=true // ELK flag
135136
LOG_LEVEL=debug // ELK log level
136137
ELK_LOG_PATH = "http://localhost:9200/" // ELK log path
137138
ELK_USERNAME=elastic // ELK user username
138-
ELK_PASSWORD=xxxxxx // ELK user password
139+
ELK_PASSWORD=xxxxxx // ELK user password
140+
141+
ORGANIZATION=credebl
142+
CONTEXT=platform
143+
APP=api

.env.sample

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ PLATFORM_ID=
9898
PLATFORM_PROFILE_MODE= // Please provide your environment name
9999

100100
OOB_BATCH_SIZE=10
101+
PROOF_REQ_CONN_LIMIT=10
101102

102103
AFJ_AGENT_ENDPOINT_PATH=/apps/agent-provisioning/AFJ/endpoints/
103104
DATABASE_URL="postgresql://postgres:xxxxxx@localhost:5432/postgres?schema=public" #Provide supabase postgres URL and Use the correct user/pwd, IP Address
@@ -162,3 +163,7 @@ LOG_LEVEL=debug // ELK log level
162163
ELK_LOG_PATH = "http://localhost:9200/" // ELK log path
163164
ELK_USERNAME=elastic // ELK user username
164165
ELK_PASSWORD=xxxxxx // ELK user password
166+
167+
ORGANIZATION=credebl
168+
CONTEXT=platform
169+
APP=api

apps/api-gateway/common/exception-handler.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,21 @@ export class CustomExceptionFilter extends BaseExceptionFilter {
2424
}
2525
if (exception instanceof HttpException) {
2626
status = exception.getStatus();
27+
2728
}
2829

29-
let exceptionResponse: ExceptionResponse;
30+
let exceptionResponse: ExceptionResponse = {} as ExceptionResponse;
31+
const exceptionResponseData = exception.getResponse ? exception.getResponse() : exception;
3032

31-
if (exception['response']) {
32-
exceptionResponse = exception['response'];
33+
if ('string' === typeof exceptionResponseData) {
34+
exceptionResponse.message = exceptionResponseData;
3335
} else {
34-
exceptionResponse = exception as unknown as ExceptionResponse;
36+
exceptionResponse = exceptionResponseData as unknown as ExceptionResponse;
3537
}
3638

39+
if (exceptionResponse.message && exceptionResponse.message.includes(ResponseMessages.nats.error.noSubscribers)) {
40+
exceptionResponse.message = ResponseMessages.nats.error.noSubscribers;
41+
}
3742
errorResponse = {
3843
statusCode: exceptionResponse.statusCode ? exceptionResponse.statusCode : status,
3944
message: exceptionResponse.message
@@ -43,7 +48,6 @@ export class CustomExceptionFilter extends BaseExceptionFilter {
4348
? exceptionResponse.error
4449
: ResponseMessages.errorMessages.serverError
4550
};
46-
4751
response.status(errorResponse.statusCode).json(errorResponse);
4852
}
4953
}

apps/api-gateway/src/agent-service/agent-service.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import { CustomExceptionFilter } from 'apps/api-gateway/common/exception-handler
4141
import { Roles } from '../authz/decorators/roles.decorator';
4242
import { OrgRoles } from 'libs/org-roles/enums';
4343
import { OrgRolesGuard } from '../authz/guards/org-roles.guard';
44-
import { validateDid } from '@credebl/common/did.validator';
44+
import { Validator } from '@credebl/common/validator';
4545
import { CreateWalletDto } from './dto/create-wallet.dto';
4646
import { CreateNewDidDto } from './dto/create-new-did.dto';
4747
import { AgentSpinupValidator, TrimStringParamPipe } from '@credebl/common/cast.helper';
@@ -223,7 +223,7 @@ export class AgentController {
223223
@User() user: user,
224224
@Res() res: Response
225225
): Promise<Response> {
226-
await validateDid(createDidDto);
226+
Validator.validateDid(createDidDto);
227227

228228
if (createDidDto.seed && seedLength !== createDidDto.seed.length) {
229229
this.logger.error(`seed must be at most 32 characters.`);

apps/api-gateway/src/cloud-wallet/cloud-wallet.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { AuthGuard } from '@nestjs/passport';
1414
import { User } from '../authz/decorators/user.decorator';
1515
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1616
import { user } from '@prisma/client';
17-
import { validateDid } from '@credebl/common/did.validator';
17+
import { Validator } from '@credebl/common/validator';
1818
import { CommonConstants } from '@credebl/common/common.constant';
1919
import { UserRoleGuard } from '../authz/guards/user-role.guard';
2020
import { AcceptProofRequestDto } from './dtos/accept-proof-request.dto';
@@ -267,7 +267,7 @@ export class CloudWalletController {
267267
@User() user: user,
268268
@Res() res: Response
269269
): Promise<Response> {
270-
await validateDid(createDidDto);
270+
Validator.validateDid(createDidDto);
271271
const {email, id} = user;
272272
createDidDto.email = email;
273273
createDidDto.userId = id;

apps/api-gateway/src/main.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as dotenv from 'dotenv';
22
import * as express from 'express';
33

44
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
5-
import { Logger, ValidationPipe } from '@nestjs/common';
5+
import { Logger, ValidationPipe, VERSION_NEUTRAL, VersioningType } from '@nestjs/common';
66

77
import { AppModule } from './app.module';
88
import { HttpAdapterHost, NestFactory } from '@nestjs/core';
@@ -13,6 +13,7 @@ import { getNatsOptions } from '@credebl/common/nats.config';
1313
import helmet from 'helmet';
1414
import { CommonConstants } from '@credebl/common/common.constant';
1515
import NestjsLoggerServiceAdapter from '@credebl/logger/nestjsLoggerServiceAdapter';
16+
import { NatsInterceptor } from '../../../libs/interceptors/nats.interceptor';
1617
dotenv.config();
1718

1819
async function bootstrap(): Promise<void> {
@@ -57,6 +58,11 @@ async function bootstrap(): Promise<void> {
5758
.addServer(`${process.env.API_GATEWAY_PROTOCOL}://${process.env.API_GATEWAY_HOST}`)
5859
.build();
5960

61+
app.enableVersioning({
62+
type: VersioningType.URI,
63+
defaultVersion: ['1']
64+
});
65+
6066
const document = SwaggerModule.createDocument(app, options);
6167
SwaggerModule.setup('api', app, document);
6268
const httpAdapter = app.get(HttpAdapterHost);
@@ -70,6 +76,11 @@ async function bootstrap(): Promise<void> {
7076
});
7177
}
7278

79+
app.enableVersioning({
80+
type: VersioningType.URI,
81+
defaultVersion: ['1', VERSION_NEUTRAL]
82+
});
83+
7384
app.use(express.static('uploadedFiles/holder-profile'));
7485
app.use(express.static('uploadedFiles/org-logo'));
7586
app.use(express.static('uploadedFiles/tenant-logo'));
@@ -85,6 +96,7 @@ async function bootstrap(): Promise<void> {
8596
xssFilter: true
8697
})
8798
);
99+
app.useGlobalInterceptors(new NatsInterceptor());
88100
await app.listen(process.env.API_GATEWAY_PORT, `${process.env.API_GATEWAY_HOST}`);
89101
Logger.log(`API Gateway is listening on port ${process.env.API_GATEWAY_PORT}`);
90102
}

apps/api-gateway/src/user/user.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export class UserController {
253253
* @returns User's email exist status
254254
*/
255255
@Get('/:email')
256-
@ApiOperation({ summary: 'Check if user exist', description: 'check user existence' })
256+
@ApiOperation({ summary: 'Check user registration and email verification status', description: 'Check user registration and email verification status' })
257257
async checkUserExist(@Param() emailParam: EmailValidator, @Res() res: Response): Promise<Response> {
258258
const userDetails = await this.userService.checkUserExist(emailParam.email);
259259

0 commit comments

Comments
 (0)