Skip to content

Commit

Permalink
fix: issuance API with required attribute (#528)
Browse files Browse the repository at this point in the history
* fix:issuance api

Signed-off-by: pranalidhanavade <[email protected]>

* fix:issuance api issue

Signed-off-by: pranalidhanavade <[email protected]>

* fix:sonarlint issues

Signed-off-by: pranalidhanavade <[email protected]>

* fix:requried attribute in issuance api

Signed-off-by: pranalidhanavade <[email protected]>

* fix:requried attributes in csv file

Signed-off-by: pranalidhanavade <[email protected]>

---------

Signed-off-by: pranalidhanavade <[email protected]>
Signed-off-by: KulkarniShashank <[email protected]>
  • Loading branch information
pranalidhanavade authored and KulkarniShashank committed Sep 11, 2024
1 parent 541a06c commit 11d7b50
Show file tree
Hide file tree
Showing 2 changed files with 170 additions and 109 deletions.
16 changes: 8 additions & 8 deletions apps/api-gateway/src/issuance/dtos/issuance.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ class Attribute {
@Transform(({ value }) => trim(value))
value: string;

@ApiProperty()
@ApiProperty({ default: false })
@IsBoolean()
@IsOptional()
@IsNotEmpty({ message: 'isRequired property is required' })
isRequired: boolean;
isRequired?: boolean = false;

}

Expand Down Expand Up @@ -86,8 +87,7 @@ export class OOBIssueCredentialDto extends CredentialsIssuanceDto {
example: [
{
value: 'string',
name: 'string',
isRequired: 'boolean'
name: 'string'
}
]
})
Expand All @@ -99,7 +99,7 @@ export class OOBIssueCredentialDto extends CredentialsIssuanceDto {
}

class CredentialOffer {
@ApiProperty({ example: [{ 'value': 'string', 'name': 'string', 'isRequired':'boolean' }] })
@ApiProperty({ example: [{ 'value': 'string', 'name': 'string' }] })
@IsNotEmpty({ message: 'Attribute name is required' })
@IsArray({ message: 'Attributes should be an array' })
@ArrayNotEmpty({ message: 'Attributes are required' })
Expand All @@ -108,8 +108,8 @@ class CredentialOffer {
@Type(() => Attribute)
attributes: Attribute[];

@ApiProperty()
@IsEmail({}, { message: 'Email is invalid' })
@ApiProperty({ example: '[email protected]' })
@IsEmail({}, { message: 'Please provide a valid email' })
@IsNotEmpty({ message: 'Email is required' })
@MaxLength(256, { message: 'Email must be at most 256 character' })
@Transform(({ value }) => trim(value))
Expand Down Expand Up @@ -212,7 +212,7 @@ export class CredentialAttributes {
}

export class OOBCredentialDtoWithEmail {
@ApiProperty({ example: [{ 'emailId': '[email protected]', 'attributes': [{ 'value': 'string', 'name': 'string', 'isRequired':'boolean' }] }] })
@ApiProperty({ example: [{ 'emailId': '[email protected]', 'attributes': [{ 'value': 'string', 'name': 'string' }] }] })
@IsNotEmpty({ message: 'Please provide valid attributes' })
@IsArray({ message: 'attributes should be array' })
@ArrayMaxSize(Number(process.env.OOB_BATCH_SIZE), { message: `Limit reached (${process.env.OOB_BATCH_SIZE} credentials max). Easily handle larger batches via seamless CSV file uploads` })
Expand Down
Loading

0 comments on commit 11d7b50

Please sign in to comment.