From a748b533f0212db58019678f742129ce0ba354ba Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Mon, 14 Oct 2024 12:47:37 +0530 Subject: [PATCH] hotfix: add height width configurations for pretty vc and trim validations for email identifier field Signed-off-by: bhavanakarwade --- apps/api-gateway/src/issuance/dtos/issuance.dto.ts | 12 ++++++++++++ apps/issuance/src/issuance.service.ts | 10 +++++++--- libs/common/src/interfaces/issuance.interface.ts | 2 ++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts index f707b9a47..87f9bcf2c 100644 --- a/apps/api-gateway/src/issuance/dtos/issuance.dto.ts +++ b/apps/api-gateway/src/issuance/dtos/issuance.dto.ts @@ -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() diff --git a/apps/issuance/src/issuance.service.ts b/apps/issuance/src/issuance.service.ts index 05dba9184..32ab732f7 100644 --- a/apps/issuance/src/issuance.service.ts +++ b/apps/issuance/src/issuance.service.ts @@ -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 } }; @@ -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); @@ -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); diff --git a/libs/common/src/interfaces/issuance.interface.ts b/libs/common/src/interfaces/issuance.interface.ts index 593e0d1d8..3e9a133c3 100644 --- a/libs/common/src/interfaces/issuance.interface.ts +++ b/libs/common/src/interfaces/issuance.interface.ts @@ -85,6 +85,8 @@ export interface IIssuedCredential { certificate: string; size: string; orientation: string; + height?: string; + width?: string; } interface ICredentialSubject {