diff --git a/apps/api-gateway/common/exception-handler.ts b/apps/api-gateway/common/exception-handler.ts index 5df61a442..38259e86e 100644 --- a/apps/api-gateway/common/exception-handler.ts +++ b/apps/api-gateway/common/exception-handler.ts @@ -41,13 +41,12 @@ export class CustomExceptionFilter extends BaseExceptionFilter { if (exception && exception["response"] && exception.message) { if (Array.isArray(exception["response"].message)) { - exception["response"].message.forEach((msg) => { - errorResponse = { - statusCode: exception["statusCode"] ? exception["statusCode"] : status, - message: msg || 'Internal server error', - error: msg || 'Internal server error' - }; - }); + + errorResponse = { + statusCode: exception["statusCode"] ? exception["statusCode"] : status, + message: exception.message ? exception.message : 'Internal server error', + error: exception["response"].message ? exception["response"].message : exception["response"] ? exception["response"] : 'Internal server error' + }; } else { errorResponse = { statusCode: exception["statusCode"] ? exception["statusCode"] : status, diff --git a/apps/api-gateway/src/user/dto/add-user.dto.ts b/apps/api-gateway/src/user/dto/add-user.dto.ts index 05983a924..e0dea93df 100644 --- a/apps/api-gateway/src/user/dto/add-user.dto.ts +++ b/apps/api-gateway/src/user/dto/add-user.dto.ts @@ -9,18 +9,17 @@ export class AddUserDetails { @IsEmail() @IsNotEmpty({ message: 'Please provide valid email' }) @IsString({ message: 'email should be string' }) - @IsOptional() - email?: string; + email: string; @ApiProperty({ example: 'Alen' }) + @IsNotEmpty({ message: 'Please provide valid email' }) @IsString({ message: 'firstName should be string' }) - @IsOptional() - firstName?: string; + firstName: string; @ApiProperty({ example: 'Harvey' }) + @IsNotEmpty({ message: 'Please provide valid email' }) @IsString({ message: 'lastName should be string' }) - @IsOptional() - lastName?: string; + lastName: string; @ApiProperty() @Transform(({ value }) => trim(value))