From 6b1b883790e94a5bbda38dfc3636ca7c2699fd4a Mon Sep 17 00:00:00 2001 From: tipusinghaw <126460794+tipusinghaw@users.noreply.github.com> Date: Wed, 24 Apr 2024 12:24:09 +0530 Subject: [PATCH] fix: fix wallet spinup dto issue (#675) Signed-off-by: tipusinghaw Signed-off-by: KulkarniShashank --- .../src/agent-service/agent-service.controller.ts | 4 ++-- apps/api-gateway/src/agent-service/dto/create-did.dto.ts | 7 +------ .../src/agent-service/dto/create-new-did.dto.ts | 9 +++++++++ 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 apps/api-gateway/src/agent-service/dto/create-new-did.dto.ts diff --git a/apps/api-gateway/src/agent-service/agent-service.controller.ts b/apps/api-gateway/src/agent-service/agent-service.controller.ts index e73d53eaa..d4765ff16 100644 --- a/apps/api-gateway/src/agent-service/agent-service.controller.ts +++ b/apps/api-gateway/src/agent-service/agent-service.controller.ts @@ -32,9 +32,9 @@ import { CustomExceptionFilter } from 'apps/api-gateway/common/exception-handler import { Roles } from '../authz/decorators/roles.decorator'; import { OrgRoles } from 'libs/org-roles/enums'; import { OrgRolesGuard } from '../authz/guards/org-roles.guard'; -import { CreateDidDto } from './dto/create-did.dto'; import { validateDid } from '@credebl/common/did.validator'; import { CreateWalletDto } from './dto/create-wallet.dto'; +import { CreateNewDidDto } from './dto/create-new-did.dto'; const seedLength = 32; @@ -232,7 +232,7 @@ export class AgentController { @ApiResponse({ status: HttpStatus.CREATED, description: 'Success', type: ApiResponseDto }) async createDid( @Param('orgId') orgId: string, - @Body() createDidDto: CreateDidDto, + @Body() createDidDto: CreateNewDidDto, @User() user: user, @Res() res: Response ): Promise { diff --git a/apps/api-gateway/src/agent-service/dto/create-did.dto.ts b/apps/api-gateway/src/agent-service/dto/create-did.dto.ts index 3c34bef46..bc36bac98 100644 --- a/apps/api-gateway/src/agent-service/dto/create-did.dto.ts +++ b/apps/api-gateway/src/agent-service/dto/create-did.dto.ts @@ -1,7 +1,7 @@ import { trim } from '@credebl/common/cast.helper'; import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { Transform } from 'class-transformer'; -import { MaxLength, IsString, Matches, IsNotEmpty, IsOptional, IsBoolean } from 'class-validator'; +import { MaxLength, IsString, Matches, IsNotEmpty, IsOptional } from 'class-validator'; export class CreateDidDto { @@ -75,9 +75,4 @@ export class CreateDidDto { @Transform(({ value }) => trim(value)) @IsString({ message: 'endorser did must be in string format.' }) endorserDid?: string; - - @ApiProperty({example: false}) - @ApiPropertyOptional() - @IsBoolean({ message: 'isPrimaryDid did must be true or false.' }) - isPrimaryDid: boolean = false; } \ No newline at end of file diff --git a/apps/api-gateway/src/agent-service/dto/create-new-did.dto.ts b/apps/api-gateway/src/agent-service/dto/create-new-did.dto.ts new file mode 100644 index 000000000..4ebe9e99d --- /dev/null +++ b/apps/api-gateway/src/agent-service/dto/create-new-did.dto.ts @@ -0,0 +1,9 @@ +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsBoolean } from 'class-validator'; +import { CreateDidDto } from './create-did.dto'; +export class CreateNewDidDto extends CreateDidDto { + @ApiProperty({example: false}) + @ApiPropertyOptional() + @IsBoolean({ message: 'isPrimaryDid did must be true or false.' }) + isPrimaryDid: boolean = false; +} \ No newline at end of file