diff --git a/apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts b/apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts
index c02f31c66..5d92e5b61 100644
--- a/apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts
+++ b/apps/api-gateway/src/interfaces/ISchemaSearch.interface.ts
@@ -1,3 +1,4 @@
+import { SchemaType } from '@credebl/enum/enum';
import { IUserRequestInterface } from '../schema/interfaces';
export interface ISchemaSearchPayload {
@@ -7,6 +8,7 @@ export interface ISchemaSearchPayload {
sortField: string;
sortBy: string;
searchByText?: string;
+ schemaType?: SchemaType;
user?: IUserRequestInterface
}
diff --git a/apps/api-gateway/src/platform/platform.controller.ts b/apps/api-gateway/src/platform/platform.controller.ts
index 1359e1b45..980acfb02 100644
--- a/apps/api-gateway/src/platform/platform.controller.ts
+++ b/apps/api-gateway/src/platform/platform.controller.ts
@@ -12,7 +12,7 @@ import { ResponseMessages } from '@credebl/common/response-messages';
import { CustomExceptionFilter } from 'apps/api-gateway/common/exception-handler';
import { AuthGuard } from '@nestjs/passport';
import * as QRCode from 'qrcode';
-import { CredDefSortFields, SortFields } from '@credebl/enum/enum';
+import { CredDefSortFields, SchemaType, SortFields } from '@credebl/enum/enum';
import { GetAllPlatformCredDefsDto } from '../credential-definition/dto/get-all-platform-cred-defs.dto';
@Controller('')
@@ -32,6 +32,11 @@ export class PlatformController {
name: 'sortField',
enum: SortFields,
required: false
+ })
+ @ApiQuery({
+ name: 'schemaType',
+ enum: SchemaType,
+ required: false
})
@ApiBearerAuth()
@UseGuards(AuthGuard('jwt'))
@@ -41,14 +46,15 @@ export class PlatformController {
@Res() res: Response,
@User() user: IUserRequestInterface
): Promise {
- const { ledgerId, pageSize, searchByText, pageNumber, sorting, sortByValue } = getAllSchemaDto;
+ const { ledgerId, pageSize, searchByText, pageNumber, sorting, sortByValue, schemaType } = getAllSchemaDto;
const schemaSearchCriteria: ISchemaSearchPayload = {
ledgerId,
pageNumber,
searchByText,
pageSize,
sortField: sorting,
- sortBy: sortByValue
+ sortBy: sortByValue,
+ schemaType
};
const schemasResponse = await this.platformService.getAllSchema(schemaSearchCriteria, user);
const finalResponse: IResponse = {
diff --git a/apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts b/apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts
index 3af21ac57..797f924cf 100644
--- a/apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts
+++ b/apps/api-gateway/src/schema/dtos/get-all-schema.dto.ts
@@ -4,7 +4,7 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Transform, Type } from 'class-transformer';
import { IsEnum, IsOptional, IsUUID, Min } from 'class-validator';
import { toNumber, trim } from '@credebl/common/cast.helper';
-import { CredDefSortFields, SortFields, SortValue } from '@credebl/enum/enum';
+import { CredDefSortFields, SchemaType, SortFields, SortValue } from '@credebl/enum/enum';
export class GetAllSchemaDto {
@ApiProperty({ required: false })
@@ -121,5 +121,14 @@ export class GetAllSchemaByPlatformDto {
@ApiProperty({ required: false })
@IsOptional()
sortByValue: string = SortValue.DESC;
+
+ @ApiProperty({
+ type: SchemaType,
+ required: false
+ })
+ @Transform(({ value }) => trim(value))
+ @IsOptional()
+ @IsEnum(SchemaType)
+ schemaType: SchemaType;
}
\ No newline at end of file
diff --git a/apps/ecosystem/templates/DeleteEcosystemMemberTemplate.ts b/apps/ecosystem/templates/DeleteEcosystemMemberTemplate.ts
index cfe35fcfc..2cba626dd 100644
--- a/apps/ecosystem/templates/DeleteEcosystemMemberTemplate.ts
+++ b/apps/ecosystem/templates/DeleteEcosystemMemberTemplate.ts
@@ -27,7 +27,7 @@ export class DeleteEcosystemMemberTemplate {
Hello ${email},
- We would like to inform you that the organization“${orgName}”, has removed their participation as a member from the "${ecosystemName}" ecsosystem on CREDEBL.
+ We would like to inform you that the organization “${orgName}”, has removed their participation as a member from the "${ecosystemName}" on CREDEBL.
diff --git a/apps/ledger/src/schema/interfaces/schema-payload.interface.ts b/apps/ledger/src/schema/interfaces/schema-payload.interface.ts
index 4bc1866de..4c6eb1d63 100644
--- a/apps/ledger/src/schema/interfaces/schema-payload.interface.ts
+++ b/apps/ledger/src/schema/interfaces/schema-payload.interface.ts
@@ -1,4 +1,4 @@
-import { SortValue } from '@credebl/enum/enum';
+import { SchemaType, SortValue } from '@credebl/enum/enum';
import { IUserRequestInterface } from './schema.interface';
export interface ISchema {
@@ -57,6 +57,7 @@ export interface ISchemaSearchCriteria {
sortField: string;
sortBy: string;
searchByText?: string;
+ schemaType?: SchemaType;
user?: IUserRequestInterface
schemaId?: string;
orgId?: string;
diff --git a/apps/ledger/src/schema/repositories/schema.repository.ts b/apps/ledger/src/schema/repositories/schema.repository.ts
index d8e4f3b68..031db374c 100644
--- a/apps/ledger/src/schema/repositories/schema.repository.ts
+++ b/apps/ledger/src/schema/repositories/schema.repository.ts
@@ -213,14 +213,16 @@ export class SchemaRepository {
async getAllSchemaDetails(payload: ISchemaSearchCriteria): Promise {
try {
+ const { ledgerId, schemaType, searchByText, sortField, sortBy, pageSize, pageNumber } = payload;
const schemasResult = await this.prisma.schema.findMany({
where: {
- ledgerId: payload.ledgerId,
+ ledgerId,
+ type: schemaType,
OR: [
- { name: { contains: payload.searchByText, mode: 'insensitive' } },
- { version: { contains: payload.searchByText, mode: 'insensitive' } },
- { schemaLedgerId: { contains: payload.searchByText, mode: 'insensitive' } },
- { issuerId: { contains: payload.searchByText, mode: 'insensitive' } }
+ { name: { contains: searchByText, mode: 'insensitive' } },
+ { version: { contains: searchByText, mode: 'insensitive' } },
+ { schemaLedgerId: { contains: searchByText, mode: 'insensitive' } },
+ { issuerId: { contains: searchByText, mode: 'insensitive' } }
]
},
select: {
@@ -232,18 +234,20 @@ export class SchemaRepository {
createdBy: true,
publisherDid: true,
orgId: true, // This field can be null
- issuerId: true
+ issuerId: true,
+ type: true
},
orderBy: {
- [payload.sortField]: SortValue.DESC === payload.sortBy ? SortValue.DESC : SortValue.ASC
+ [sortField]: SortValue.DESC === sortBy ? SortValue.DESC : SortValue.ASC
},
- take: Number(payload.pageSize),
- skip: (payload.pageNumber - 1) * payload.pageSize
+ take: Number(pageSize),
+ skip: (pageNumber - 1) * pageSize
});
const schemasCount = await this.prisma.schema.count({
where: {
- ledgerId: payload.ledgerId
+ ledgerId,
+ type: schemaType
}
});