Skip to content

Commit

Permalink
hotfix: add height width configurations for pretty vc and trim valida…
Browse files Browse the repository at this point in the history
…tions for email identifier field

Signed-off-by: bhavanakarwade <[email protected]>
  • Loading branch information
bhavanakarwade committed Oct 14, 2024
1 parent 0435996 commit a748b53
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
12 changes: 12 additions & 0 deletions apps/api-gateway/src/issuance/dtos/issuance.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ class PrettyVc {
@Transform(({ value }) => trim(value))
@IsString({ message: 'orientation must be in string format.' })
orientation: string;

@ApiPropertyOptional({ example: '60px' })
@IsOptional()
@Transform(({ value }) => trim(value))
@IsString({ message: 'height must be in string format.' })
height?: string;

@ApiPropertyOptional({ example: '60px' })
@IsOptional()
@Transform(({ value }) => trim(value))
@IsString({ message: 'width must be in string format.' })
width?: string;
}
export class Credential {
@ApiProperty()
Expand Down
10 changes: 7 additions & 3 deletions apps/issuance/src/issuance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,9 @@ async outOfBandCredentialOffer(outOfBandCredential: OutOfBandCredentialOfferPayl
prettyVc: {
certificate: prettyVc?.certificate,
size: prettyVc?.size,
orientation: prettyVc?.orientation
orientation: prettyVc?.orientation,
height: prettyVc?.height,
width: prettyVc?.width
}
};

Expand Down Expand Up @@ -1118,7 +1120,7 @@ async sendEmailForCredentialOffer(sendEmailCredentialOffer: SendEmailCredentialO
if (0 >= parsedData.meta.fields.length) {
throw new BadRequestException(ResponseMessages.bulkIssuance.error.emptyheader);
}
const invalidEmails = parsedData.data.filter((entry) => !validateEmail(entry.email_identifier));
const invalidEmails = parsedData.data.filter((entry) => !validateEmail(entry.email_identifier.trim()));

if (0 < invalidEmails.length) {
throw new BadRequestException(ResponseMessages.bulkIssuance.error.invalidEmails);
Expand Down Expand Up @@ -1611,7 +1613,9 @@ async sendEmailForCredentialOffer(sendEmailCredentialOffer: SendEmailCredentialO
prettyVc = {
certificate: jobDetails?.certificate,
size: jobDetails?.size,
orientation: jobDetails?.orientation
orientation: jobDetails?.orientation,
height: prettyVc?.height,
width: prettyVc?.width
};

oobIssuancepayload = await createOobJsonldIssuancePayload(JsonldCredentialDetails, prettyVc);
Expand Down
2 changes: 2 additions & 0 deletions libs/common/src/interfaces/issuance.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export interface IIssuedCredential {
certificate: string;
size: string;
orientation: string;
height?: string;
width?: string;
}

interface ICredentialSubject {
Expand Down

0 comments on commit a748b53

Please sign in to comment.