-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: multiselect connection while issuance (#629)
* feat: multiselect connections while issuance Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com> * feat: multi select connections functionality while issuance Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com> * feat: multi select connections Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com> * refactor: modify error message Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com> * fix: resolved comments Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com> * resolved comments Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com> --------- Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com> Signed-off-by: KulkarniShashank <shashank.kulkarni@ayanworks.com>
- Loading branch information
1 parent
88cde44
commit e54a711
Showing
8 changed files
with
135 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
apps/api-gateway/src/issuance/dtos/multi-connection.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { ArrayMaxSize, ArrayMinSize, IsArray, IsBoolean, IsEnum, IsNotEmpty, IsOptional, IsString, ValidateNested } from 'class-validator'; | ||
import { Transform, Type } from 'class-transformer'; | ||
|
||
import { AutoAccept } from '@credebl/enum/enum'; | ||
import { trim } from '@credebl/common/cast.helper'; | ||
import { Attribute, CredentialsIssuanceDto } from './issuance.dto'; | ||
|
||
class ConnectionAttributes { | ||
@ApiProperty({ example: 'string' }) | ||
@IsNotEmpty({ message: 'connectionId is required' }) | ||
@IsString({ message: 'connectionId should be string' }) | ||
@Transform(({ value }) => trim(value)) | ||
connectionId: string; | ||
|
||
@ApiProperty({ | ||
example: [ | ||
{ | ||
value: 'string', | ||
name: 'string' | ||
} | ||
] | ||
}) | ||
@IsArray() | ||
@ValidateNested({ each: true }) | ||
@ArrayMinSize(1) | ||
@IsNotEmpty({ message: 'Please provide valid attributes' }) | ||
@Type(() => Attribute) | ||
attributes: Attribute[]; | ||
} | ||
|
||
export class IssueCredentialDto extends CredentialsIssuanceDto { | ||
@ApiProperty({ | ||
example: [ | ||
{ | ||
connectionId: 'string', | ||
attributes: [ | ||
{ | ||
value: 'string', | ||
name: 'string' | ||
} | ||
] | ||
} | ||
] | ||
}) | ||
@IsArray() | ||
@ValidateNested({ each: true }) | ||
@ArrayMinSize(1) | ||
@ArrayMaxSize(Number(process.env.OOB_BATCH_SIZE), { message: `Limit reached (${process.env.OOB_BATCH_SIZE} connections max).` }) | ||
@IsNotEmpty({ message: 'credentialData is required' }) | ||
@Type(() => ConnectionAttributes) | ||
credentialData: ConnectionAttributes[]; | ||
|
||
@ApiPropertyOptional() | ||
@IsOptional() | ||
@IsString({ message: 'auto accept proof must be in string' }) | ||
@IsNotEmpty({ message: 'please provide valid auto accept proof' }) | ||
@IsEnum(AutoAccept, { | ||
message: `Invalid auto accept credential. It should be one of: ${Object.values(AutoAccept).join(', ')}` | ||
}) | ||
autoAcceptCredential?: string; | ||
|
||
@ApiProperty({ | ||
example: false | ||
}) | ||
@IsOptional() | ||
@IsNotEmpty() | ||
@IsBoolean({message: 'isShortenUrl must be boolean'}) | ||
isShortenUrl?: boolean; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters