Skip to content

Commit

Permalink
merge: develop to qa (17-07-2024) (#833)
Browse files Browse the repository at this point in the history
* fix: create organisation changes and added geo-location attribute in response

Signed-off-by: Ganesh Nawle <[email protected]>

* fix: send email verification issue (#823)

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

* refactor: bulk issuance template list response changes (#824)

* refactor: updated schema response for get API

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

* fix: schema already exist logic

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

* fix: schema attribute while w3c schema creation

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

---------

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

* feat: batch bulk issunace (#826)

* feat: batch bulk issuance

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

* stoped queue to remove issuance data

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

* feat: added delay for 1 min

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

* refactor: changed batch config

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

* feat: changed delay time for batch

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

* feat: added batch for retry

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

* refactor: added common constant in libs

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

* refactor: removed duplicate value from schema DTO

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

---------

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

* fix: constant issue for bulk issunace (#827)

* feat: batch bulk issuance

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

* stoped queue to remove issuance data

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

* feat: added delay for 1 min

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

* refactor: changed batch config

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

* feat: changed delay time for batch

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

* feat: added batch for retry

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

* refactor: added common constant in libs

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

* refactor: removed duplicate value from schema DTO

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

* fix: constent issue

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

---------

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

* refactor: schema endorsement flow (#828)

* fix: send email verification issue

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

* refcator: schema endorsement flow

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

* fix: resolved sonar lint issues

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

* fix: worked on sonarcloud issues

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

---------

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

* fix: delete organization bugs (#829)

* fix: send email verification issue

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

* refcator: schema endorsement flow

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

* fix: resolved sonar lint issues

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

* fix: worked on sonarcloud issues

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

* fix: delete organization bugs

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

---------

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

* feature:added schema details in file_upload data and fix minor changes

Signed-off-by: Ganesh Nawle <[email protected]>

* feature:added schema details in file_upload data,fix minor exception changes and resovle PR conflict

Signed-off-by: Ganesh Nawle <[email protected]>

* feat: added schema details in  table

Signed-off-by: Ganesh Nawle <[email protected]>

* refactor: endorsement flow for key and web method (#831)

* refactor: endorsement flow for key and web method

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

* refactor: send email for issuance

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

---------

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

* fix: prisma model issue and refactored file_upload model

Signed-off-by: Ganesh Nawle <[email protected]>

* fix: prisma migration issue

Signed-off-by: Ganesh Nawle <[email protected]>

* fix: prisma migration issue (#835)

Signed-off-by: Ganesh Nawle <[email protected]>

* fix: prisma migration issue

Signed-off-by: Ganesh Nawle <[email protected]>

* fix: parameter and response related bugs (#837)

* fix: send email verification issue

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

* refcator: schema endorsement flow

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

* fix: resolved sonar lint issues

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

* fix: worked on sonarcloud issues

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

* fix: delete organization bugs

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

* fix: cred def id space fixes

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

* fix: create organization bug

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

---------

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

* fix:rollback statistics changes

Signed-off-by: Ganesh Nawle <[email protected]>

* Fix/bugs (#839)

* fix: send email verification issue

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

* refcator: schema endorsement flow

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

* fix: resolved sonar lint issues

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

* fix: worked on sonarcloud issues

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

* fix: delete organization bugs

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

* fix: cred def id space fixes

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

* fix: create organization bug

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

* fix: pagination issue for preview file

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

* fix: pagination issue

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

---------

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

* fix: imageurl issue for verification process (#840)

* fix: send email verification issue

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

* refcator: schema endorsement flow

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

* fix: resolved sonar lint issues

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

* fix: worked on sonarcloud issues

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

* fix: delete organization bugs

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

* fix: cred def id space fixes

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

* fix: create organization bug

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

* fix: pagination issue for preview file

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

* fix: pagination issue

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

* fix: imageurl issue in verification

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

---------

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

* fix: made reuqest Id parameter optional (#841)

* fix: send email verification issue

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

* refcator: schema endorsement flow

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

* fix: resolved sonar lint issues

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

* fix: worked on sonarcloud issues

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

* fix: delete organization bugs

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

* fix: cred def id space fixes

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

* fix: create organization bug

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

* fix: pagination issue for preview file

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

* fix: pagination issue

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

* fix: imageurl issue in verification

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

* fix: made request if parameter optional

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

---------

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

* refactor: added temaplateId column in file_upload table (#842)

* fix: send email verification issue

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

* refcator: schema endorsement flow

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

* fix: resolved sonar lint issues

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

* fix: worked on sonarcloud issues

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

* fix: delete organization bugs

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

* fix: cred def id space fixes

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

* fix: create organization bug

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

* fix: pagination issue for preview file

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

* fix: pagination issue

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

* fix: imageurl issue in verification

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

* fix: made request if parameter optional

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

* refactor: added templateId mapping in file upload functionality

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

* refactor: interface types

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

---------

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

* feat: changed issuance email template for EDUCRED

Signed-off-by: Ganesh Nawle <[email protected]>

* fix:refactored preview uploaded file api changed query Param to path param

Signed-off-by: Ganesh Nawle <[email protected]>

* added-logger statement

Signed-off-by: Ganesh Nawle <[email protected]>

* fix:Minor fixes

Signed-off-by: Ganesh Nawle <[email protected]>

* fix:removed all console logs

Signed-off-by: Ganesh Nawle <[email protected]>

* feat:refactored  api to add dynamic support to email template

Signed-off-by: Ganesh Nawle <[email protected]>

---------

Signed-off-by: Ganesh Nawle <[email protected]>
Signed-off-by: bhavanakarwade <[email protected]>
Signed-off-by: tipusinghaw <[email protected]>
Co-authored-by: Ganesh Nawle <[email protected]>
Co-authored-by: ganesh_nawle <[email protected]>
Co-authored-by: tipusinghaw <[email protected]>
Co-authored-by: shitrerohit <[email protected]>
  • Loading branch information
5 people authored Jul 17, 2024
1 parent 13bc4c4 commit f4e3bc4
Show file tree
Hide file tree
Showing 39 changed files with 1,780 additions and 1,381 deletions.
25 changes: 16 additions & 9 deletions apps/agent-service/src/agent-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import {
IAgentConfigure,
OrgDid
} from './interface/agent-service.interface';
import { AgentSpinUpStatus, AgentType, DidMethod, Ledgers, OrgAgentType } from '@credebl/enum/enum';
import { AgentSpinUpStatus, AgentType, DidMethod, Ledgers, OrgAgentType, PromiseResult } from '@credebl/enum/enum';
import { AgentServiceRepository } from './repositories/agent-service.repository';
import { Prisma, RecordType, ledgers, org_agents, organisation, platform_config, user } from '@prisma/client';
import { CommonConstants } from '@credebl/common/common.constant';
Expand Down Expand Up @@ -802,9 +802,14 @@ export class AgentServiceService {
let agentProcess;
let ledgerIdData = [];
try {
if (payload.method !== DidMethod.KEY && payload.method !== DidMethod.WEB) {
let ledger;
const { network } = payload;
const ledger = await ledgerName(network);
if (network) {
ledger = await ledgerName(network);
} else {
ledger = Ledgers.Not_Applicable;
}

const ledgerList = (await this._getALlLedgerDetails()) as unknown as LedgerListResponse;
const isLedgerExist = ledgerList.response.find((existingLedgers) => existingLedgers.name === ledger);
if (!isLedgerExist) {
Expand All @@ -813,10 +818,8 @@ export class AgentServiceService {
description: ResponseMessages.errorMessages.notFound
});
}

ledgerIdData = await this.agentServiceRepository.getLedgerDetails(ledger);
}


const agentSpinUpStatus = AgentSpinUpStatus.PROCESSED;

// Create and stored agent details
Expand Down Expand Up @@ -859,7 +862,7 @@ export class AgentServiceService {
orgAgentTypeId,
tenantId: tenantDetails.walletResponseDetails['id'],
walletName: payload.label,
ledgerId: ledgerIdData ? ledgerIdData.map((item) => item.id) : null,
ledgerId: ledgerIdData.map((item) => item.id),
id: agentProcess?.id
};

Expand Down Expand Up @@ -1659,11 +1662,15 @@ export class AgentServiceService {
this.agentServiceRepository.getAgentApiKey(orgId)
]);

if (getApiKeyResult.status === 'rejected') {
if (orgAgentResult.status === PromiseResult.FULFILLED && !orgAgentResult.value) {
throw new NotFoundException(ResponseMessages.agent.error.walletDoesNotExists);
}

if (getApiKeyResult.status === PromiseResult.REJECTED) {
throw new InternalServerErrorException(`Failed to get API key: ${getApiKeyResult.reason}`);
}

if (orgAgentResult.status === 'rejected') {
if (orgAgentResult.status === PromiseResult.REJECTED) {
throw new InternalServerErrorException(`Failed to get agent information: ${orgAgentResult.reason}`);
}

Expand Down
21 changes: 11 additions & 10 deletions apps/api-gateway/src/dtos/create-schema.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,31 @@ import { IsNotSQLInjection, trim } from '@credebl/common/cast.helper';
import { JSONSchemaType, SchemaTypeEnum, W3CSchemaDataType } from '@credebl/enum/enum';

class W3CAttributeValue {

@ApiProperty()
@IsString()
@Transform(({ value }) => trim(value))
@IsNotEmpty({ message: 'attributeName is required' })
attributeName: string;

@ApiProperty({
description: 'The type of the schema',
enum: W3CSchemaDataType,
example: W3CSchemaDataType.STRING
})
@IsEnum(W3CSchemaDataType, { message: 'Schema data type must be a valid type' })
schemaDataType: W3CSchemaDataType;

@ApiProperty()
@IsString()
@Transform(({ value }) => trim(value))
@IsNotEmpty({ message: 'displayName is required' })
displayName: string;

@ApiProperty({
description: 'The type of the schema',
enum: W3CSchemaDataType,
example: W3CSchemaDataType.STRING
})
@IsEnum(W3CSchemaDataType, { message: 'Schema data type must be a valid type' })
schemaDataType: W3CSchemaDataType;

@ApiProperty()
@IsBoolean()
@IsNotEmpty({ message: 'isRequired property is required' })
isRequired: boolean;
}
}
class AttributeValue {

@ApiProperty()
Expand Down Expand Up @@ -114,6 +113,8 @@ export class CreateW3CSchemaDto {
})
@ValidateNested({each: true})
@Type(() => W3CAttributeValue)
@IsArray({ message: 'attributes must be an array' })
@ArrayMinSize(1)
@IsNotEmpty()
attributes: W3CAttributeValue [];

Expand Down
147 changes: 89 additions & 58 deletions apps/api-gateway/src/ecosystem/dtos/request-schema.dto.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ApiProperty } from '@nestjs/swagger';
import { ApiExtraModels, ApiProperty, getSchemaPath } from '@nestjs/swagger';
import { Transform, Type } from 'class-transformer';
import { ArrayMinSize, IsArray, IsBoolean, IsNotEmpty, IsOptional, IsString, ValidateNested } from 'class-validator';
import { ArrayMinSize, IsArray, IsBoolean, IsEnum, IsNotEmpty, IsOptional, IsString, ValidateNested } from 'class-validator';
import { trim } from '@credebl/common/cast.helper';
import { JSONSchemaType, SchemaTypeEnum, W3CSchemaDataType } from '@credebl/enum/enum';


class AttributeValues {
Expand Down Expand Up @@ -31,20 +32,19 @@ class AttributeValues {

}


export class RequestSchemaDto {
export class RequestIndySchemaDto {

@ApiProperty()
@Transform(({ value }) => trim(value))
@IsNotEmpty({ message: 'Schema name is required' })
@IsString({ message: 'name must be in string format.' })
name: string;
schemaName: string;

@ApiProperty()
@Transform(({ value }) => trim(value))
@IsNotEmpty({ message: 'Schema version is required' })
@IsString({ message: 'version must be in string format.' })
version: string;
schemaVersion: string;

@ApiProperty({
type: [AttributeValues],
Expand All @@ -63,92 +63,123 @@ export class RequestSchemaDto {
@ValidateNested({ each: true })
@Type(() => AttributeValues)
attributes: AttributeValues[];

@ApiProperty()
@IsBoolean({ message: 'endorse must be a boolean.' })
@IsOptional()
endorse?: boolean;

userId?: string;

}

class W3CSchemaAttributesValue {

@ApiProperty()
@IsString()
@Transform(({ value }) => trim(value))
@IsNotEmpty({ message: 'title is required' })
@IsString({ message: 'title must be in string format' })
title: string;
@IsNotEmpty({ message: 'attributeName is required' })
attributeName: string;

@ApiProperty({
description: 'The type of the schema',
enum: W3CSchemaDataType,
example: W3CSchemaDataType.STRING
})
@IsEnum(W3CSchemaDataType, { message: 'Schema data type must be a valid type' })
schemaDataType: W3CSchemaDataType;

@ApiProperty()
@IsString()
@Transform(({ value }) => trim(value))
@IsNotEmpty({ message: 'type is required' })
@IsString({ message: 'type must be in string format' })
type: string;
@IsNotEmpty({ message: 'displayName is required' })
displayName: string;

@ApiProperty()
@IsBoolean({ message: 'isRequired property must be in boolean format' })
@IsBoolean()
@IsNotEmpty({ message: 'isRequired property is required' })
isRequired: boolean;
}

export class RequestW3CSchemaDto {
export class SchemaDetails {
@ApiProperty()
@IsString({ message: 'name must be a string.' })
name: string;

@ApiProperty()
@Transform(({ value }) => trim(value))
@IsNotEmpty({ message: 'schemaName is required' })
@IsString({ message: 'schemaName must be in string format.' })
schemaName: string;
@IsString({ message: 'version must be a string.' })
version: string;

@ApiProperty({
type: [W3CSchemaAttributesValue],
'example': [
{
title: 'name',
type: 'string',
isRequired: true
}
]
example: ['name', 'id']
})
@IsArray({ message: 'schemaAttributes must be an array' })
@IsNotEmpty({ message: 'schemaAttributes are required' })
@ArrayMinSize(1)
@ValidateNested({ each: true })
@Type(() => W3CSchemaAttributesValue)
schemaAttributes: W3CSchemaAttributesValue[];
@IsArray({ message: 'attributes must be an array.' })
@IsNotEmpty({ message: 'please provide valid attributes.' })
attributes: string[];

}

export class RequestW3CSchemaDto {

@ApiProperty()
@Transform(({ value }) => trim(value))
@IsNotEmpty({ message: 'did is required' })
@IsString({ message: 'did must be in string format.' })
did: string;
@IsString({ message: 'schemaName must be a string' })
@Transform(({ value }) => value.trim())
@IsNotEmpty({ message: 'schemaName is required' })
schemaName: string;

@ApiProperty()
@Transform(({ value }) => trim(value))
@IsString({ message: 'description must be a string' })
@IsNotEmpty({ message: 'description is required' })
@IsString({ message: 'description must be in string format.' })
description: string;

userId?: string;
@ApiProperty({
type: [W3CSchemaAttributesValue],
'example': [
{
attributeName: 'name',
schemaDataType: 'string',
displayName: 'Name',
isRequired: true
}
]
})
@ValidateNested({each: true})
@Type(() => W3CSchemaAttributesValue)
@IsNotEmpty()
attributes: W3CSchemaAttributesValue [];

@ApiProperty({
description: 'The type of the schema',
enum: JSONSchemaType,
example: JSONSchemaType.POLYGON_W3C
})
@IsEnum(JSONSchemaType, { message: 'Schema type must be a valid schema type' })
@IsNotEmpty({ message: 'Type is required' })
schemaType: JSONSchemaType;
}
export class SchemaDetails {
@ApiProperty()
@IsString({ message: 'name must be a string.' })
name: string;

@ApiExtraModels(RequestIndySchemaDto, RequestW3CSchemaDto)
export class RequestSchemaDto {

@ApiProperty()
@IsString({ message: 'version must be a string.' })
version: string;
@IsBoolean({ message: 'endorse property must be a boolean.' })
@IsNotEmpty({ message: 'endorse property is required' })
endorse?: boolean;

@ApiProperty({
example: ['name', 'id']
description: 'The type of the schema',
enum: SchemaTypeEnum,
example: SchemaTypeEnum.INDY
})
@IsArray({ message: 'attributes must be an array.' })
@IsNotEmpty({ message: 'please provide valid attributes.' })
attributes: string[];

@IsEnum(SchemaTypeEnum, { message: 'Type must be a valid schema type' })
@IsNotEmpty({ message: 'Type is required' })
type: SchemaTypeEnum;

@ApiProperty({
type: Object,
oneOf: [{ $ref: getSchemaPath(RequestIndySchemaDto) }, { $ref: getSchemaPath(RequestW3CSchemaDto) }]
})
@ValidateNested()
@Type(({ object }) => {
if (object.type === SchemaTypeEnum.INDY) {
return RequestIndySchemaDto;
} else if (object.type === SchemaTypeEnum.JSON) {
return RequestW3CSchemaDto;
}
})
schemaPayload: RequestIndySchemaDto | RequestW3CSchemaDto;
}

export class RequestCredDefDto {
Expand Down
Loading

0 comments on commit f4e3bc4

Please sign in to comment.