Skip to content

Commit 637dd54

Browse files
Merge pull request #1115 from credebl/develop
Sync changes from DEV to QA (24/02/2025)
2 parents 1a65a81 + 4a1423c commit 637dd54

23 files changed

+210
-46
lines changed

apps/agent-service/src/interface/agent-service.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ export interface IInputDescriptors {
361361
export interface IProofRequestPresentationDefinition {
362362
id: string;
363363
name: string;
364+
purpose?: string;
364365
input_descriptors: IInputDescriptors[];
365366
}
366367

apps/api-gateway/src/dtos/create-schema.dto.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Transform, Type } from 'class-transformer';
55
import { IsNotSQLInjection, trim } from '@credebl/common/cast.helper';
66
import { JSONSchemaType, SchemaTypeEnum, W3CSchemaDataType } from '@credebl/enum/enum';
77

8+
89
class W3CAttributeValue {
910
@ApiProperty()
1011
@IsString()
@@ -30,6 +31,14 @@ import { JSONSchemaType, SchemaTypeEnum, W3CSchemaDataType } from '@credebl/enum
3031
@IsBoolean()
3132
@IsNotEmpty({ message: 'isRequired property is required' })
3233
isRequired: boolean;
34+
35+
@ApiPropertyOptional({
36+
description: 'Array of objects with dynamic keys',
37+
isArray: true
38+
})
39+
@IsArray()
40+
@IsOptional()
41+
nestedAttributes: Record<string, Record<string, string> | string>[];
3342
}
3443
class AttributeValue {
3544

apps/api-gateway/src/issuance/dtos/issuance.dto.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ export class CredentialsIssuanceDto {
249249
reuseConnection?: boolean;
250250

251251
orgId: string;
252+
253+
isValidateSchema?: boolean;
252254
}
253255

254256
export class OOBIssueCredentialDto extends CredentialsIssuanceDto {

apps/api-gateway/src/issuance/interfaces/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ export interface UploadedFileDetails {
7070
templateId: string;
7171
fileKey: string;
7272
fileName: string;
73-
type: SchemaType
73+
type: SchemaType;
74+
isValidateSchema?: boolean;
7475
}
7576
export interface IIssuedCredentialSearchParams {
7677
pageNumber: number;

apps/api-gateway/src/issuance/issuance.controller.ts

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,20 @@ async downloadBulkIssuanceCSVTemplate(
278278
required: true,
279279
description: 'The type of schema to be used'
280280
})
281+
@ApiQuery({
282+
name: 'isValidateSchema',
283+
type: Boolean,
284+
required: false
285+
})
281286
@UseInterceptors(FileInterceptor('file'))
282287
async uploadCSVTemplate(
283288
@Param('orgId', new ParseUUIDPipe({exceptionFactory: (): Error => { throw new BadRequestException(ResponseMessages.organisation.error.invalidOrgId); }})) orgId: string,
284289
@Query(new ValidationPipe({ transform: true })) query: TemplateQuery,
285290
@UploadedFile() file: Express.Multer.File,
286291
@Body() fileDetails: object,
287292
@Res() res: Response,
288-
@Query('schemaType') schemaType: SchemaType = SchemaType.INDY
293+
@Query('schemaType') schemaType: SchemaType = SchemaType.INDY,
294+
@Query('isValidateSchema') isValidateSchema: boolean = true
289295
): Promise<object> {
290296
const { templateId } = query;
291297

@@ -301,7 +307,8 @@ async downloadBulkIssuanceCSVTemplate(
301307
type: schemaType,
302308
templateId,
303309
fileKey,
304-
fileName: fileDetails['fileName'] || file?.filename || file?.originalname
310+
fileName: fileDetails['fileName'] || file?.filename || file?.originalname,
311+
isValidateSchema
305312
};
306313

307314
const importCsvDetails = await this.issueCredentialService.uploadCSVTemplate(uploadedfileDetails);
@@ -384,6 +391,11 @@ async downloadBulkIssuanceCSVTemplate(
384391
summary: 'bulk issue credential',
385392
description: 'bulk issue credential'
386393
})
394+
@ApiQuery({
395+
name: 'isValidateSchema',
396+
type: Boolean,
397+
required: false
398+
})
387399
@ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })
388400
@ApiConsumes('multipart/form-data')
389401
@ApiBody({
@@ -409,6 +421,7 @@ async downloadBulkIssuanceCSVTemplate(
409421
@Param('orgId') orgId: string,
410422
@User() user: user,
411423
@Query(new ValidationPipe({ transform: true })) query: CredentialQuery,
424+
@Query('isValidateSchema') isValidateSchema: boolean = true,
412425
@Res() res: Response,
413426
@Body() fileDetails?: object,
414427
@UploadedFile() file?: Express.Multer.File
@@ -432,7 +445,7 @@ async downloadBulkIssuanceCSVTemplate(
432445
type: fileDetails?.['type']
433446
};
434447
}
435-
const bulkIssuanceDetails = await this.issueCredentialService.issueBulkCredential(requestId, orgId, clientDetails, reqPayload);
448+
const bulkIssuanceDetails = await this.issueCredentialService.issueBulkCredential(requestId, orgId, clientDetails, reqPayload, isValidateSchema);
436449

437450
const finalResponse: IResponse = {
438451
statusCode: HttpStatus.CREATED,
@@ -562,16 +575,23 @@ async downloadBulkIssuanceCSVTemplate(
562575
summary: 'Retry bulk issue credential',
563576
description: 'Retry bulk issue credential'
564577
})
578+
@ApiQuery({
579+
name: 'isValidateSchema',
580+
type: Boolean,
581+
required: false
582+
})
565583
async retryBulkCredentials(
566584
@Param('fileId') fileId: string,
567585
@Param('orgId') orgId: string,
586+
@Query('isValidateSchema') isValidateSchema: boolean = true,
568587
@Res() res: Response,
569588
@Body() clientDetails: ClientDetails
570589
): Promise<Response> {
571590
const bulkIssuanceDetails = await this.issueCredentialService.retryBulkCredential(
572591
fileId,
573592
orgId,
574-
clientDetails
593+
clientDetails,
594+
isValidateSchema
575595
);
576596
const finalResponse: IResponseType = {
577597
statusCode: HttpStatus.CREATED,
@@ -713,17 +733,24 @@ async downloadBulkIssuanceCSVTemplate(
713733
name:'credentialType',
714734
enum: IssueCredentialType
715735
})
736+
@ApiQuery({
737+
name: 'isValidateSchema',
738+
type: Boolean,
739+
required: false
740+
})
716741
@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
717742
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER)
718743
@ApiResponse({ status: HttpStatus.CREATED, description: 'Success', type: ApiResponseDto })
719744
async createOOBCredentialOffer(
720745
@Query('credentialType') credentialType: IssueCredentialType = IssueCredentialType.INDY,
746+
@Query('isValidateSchema') isValidateSchema: boolean = true,
721747
@Param('orgId') orgId: string,
722748
@Body() issueCredentialDto: OOBIssueCredentialDto,
723749
@Res() res: Response
724750
): Promise<Response> {
725751
issueCredentialDto.orgId = orgId;
726752
issueCredentialDto.credentialType = credentialType;
753+
issueCredentialDto.isValidateSchema = isValidateSchema;
727754
const getCredentialDetails = await this.issueCredentialService.sendCredentialOutOfBand(issueCredentialDto);
728755
const finalResponse: IResponseType = {
729756
statusCode: HttpStatus.CREATED,

apps/api-gateway/src/issuance/issuance.service.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,14 @@ export class IssuanceService extends BaseService {
121121
return this.natsClient.sendNats(this.issuanceProxy, 'issued-file-data', payload);
122122
}
123123

124-
async issueBulkCredential(requestId: string, orgId: string, clientDetails: ClientDetails, reqPayload: IReqPayload): Promise<object> {
125-
const payload = { requestId, orgId, clientDetails, reqPayload };
124+
async issueBulkCredential(requestId: string, orgId: string, clientDetails: ClientDetails, reqPayload: IReqPayload, isValidateSchema: boolean): Promise<object> {
125+
const payload = { requestId, orgId, clientDetails, reqPayload, isValidateSchema };
126+
126127
return this.natsClient.sendNatsMessage(this.issuanceProxy, 'issue-bulk-credentials', payload);
127128
}
128129

129-
async retryBulkCredential(fileId: string, orgId: string, clientDetails: ClientDetails): Promise<object> {
130-
const payload = { fileId, orgId, clientDetails };
130+
async retryBulkCredential(fileId: string, orgId: string, clientDetails: ClientDetails, isValidateSchema?: boolean): Promise<object> {
131+
const payload = { fileId, orgId, clientDetails, isValidateSchema };
131132
return this.natsClient.sendNatsMessage(this.issuanceProxy, 'retry-bulk-credentials', payload);
132133
}
133134

apps/api-gateway/src/verification/dto/request-proof.dto.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ export class InputDescriptors {
112112
@IsOptional()
113113
@IsNotEmpty({ message: 'purpose is required' })
114114
purpose:string;
115-
116-
115+
117116
@ApiProperty({type: () => [Schema]})
118117
@IsNotEmpty({ message: 'schema is required' })
119118
@ValidateNested()
@@ -132,6 +131,7 @@ export class InputDescriptors {
132131

133132
export class ProofRequestPresentationDefinition {
134133

134+
@ApiProperty()
135135
@IsString()
136136
@IsNotEmpty({ message: 'id is required' })
137137
id: string;
@@ -140,6 +140,11 @@ export class ProofRequestPresentationDefinition {
140140
@IsOptional()
141141
name: string;
142142

143+
@ApiPropertyOptional()
144+
@IsString()
145+
@IsOptional()
146+
purpose?: string;
147+
143148
@ApiProperty({type: () => [InputDescriptors]})
144149
@IsArray({ message: 'inputDescriptors must be an array' })
145150
@IsNotEmpty({ message: 'inputDescriptors is required' })
@@ -223,6 +228,7 @@ export class RequestProofDtoBase extends ProofPayload {
223228
'example':
224229
{
225230
id: '32f54163-7166-48f1-93d8-ff217bdb0653',
231+
purpose: 'Used for KYC verification.',
226232
// eslint-disable-next-line camelcase
227233
input_descriptors: [
228234
{
@@ -388,6 +394,7 @@ export class SendProofRequestPayload {
388394
'example':
389395
{
390396
id: '32f54163-7166-48f1-93d8-ff217bdb0653',
397+
purpose: 'Used for KYC verification.',
391398
inputDescriptors: [
392399
{
393400
'id': 'banking_input_1',

apps/api-gateway/src/verification/dto/webhook-proof.dto.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export class WebhookPresentationProofDto {
4141
@IsOptional()
4242
threadId: string;
4343

44+
@ApiPropertyOptional()
45+
@IsOptional()
46+
parentThreadId?: string;
47+
4448
@ApiPropertyOptional()
4549
@IsOptional()
4650
presentationId: string;

apps/api-gateway/src/verification/verification.controller.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ export class VerificationController {
239239
@Body() requestProof: RequestProofDtoV2,
240240
@Query('requestType') requestTypeV1:ProofRequestType = ProofRequestType.INDY
241241
): Promise<Response> {
242-
243242
if (requestTypeV1 === ProofRequestType.INDY && !requestProof.proofFormats) {
244243
throw new BadRequestException(`type: ${requestTypeV1} requires proofFormats`);
245244
}

apps/issuance/interfaces/issuance.interfaces.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ export interface ImportFileDetails {
195195
templateId: string;
196196
fileKey: string;
197197
fileName: string;
198-
type: string
198+
type: string;
199+
isValidateSchema?: boolean;
199200
}
200201
export interface ICredentialPayload {
201202
schemaLedgerId: string,
@@ -298,6 +299,7 @@ export interface SendEmailCredentialOffer {
298299
platformName?: string,
299300
organizationLogoUrl?: string;
300301
prettyVc?: IPrettyVc;
302+
isValidateSchema?: boolean;
301303
}
302304

303305
export interface TemplateDetailsInterface {
@@ -328,6 +330,7 @@ export interface IQueuePayload{
328330
id: string;
329331
jobId: string;
330332
cacheId?: string;
333+
isValidateSchema?: boolean;
331334
clientId: string;
332335
referenceId: string;
333336
fileUploadId: string;
@@ -383,6 +386,7 @@ export interface BulkPayloadDetails {
383386
clientId: string;
384387
orgId: string;
385388
requestId?: string;
389+
isValidateSchema?: boolean;
386390
isRetry: boolean;
387391
organizationLogoUrl?: string;
388392
platformName?: string;
@@ -392,3 +396,7 @@ export interface BulkPayloadDetails {
392396
height?: string;
393397
width?: string;
394398
}
399+
400+
export interface ISchemaId {
401+
schemaLedgerId: string;
402+
}

0 commit comments

Comments
 (0)