diff --git a/apps/shared/package.json b/apps/shared/package.json index e092ae552055278ec57d94efd8a8623dd2c7fccf..0553f1a7adf27a9aee67233dda5075fe7e6777dd 100644 --- a/apps/shared/package.json +++ b/apps/shared/package.json @@ -27,7 +27,10 @@ "@elastic/ecs-winston-format": "^1.5.0", "@nestjs/common": "^10.2.10", "@nestjs/microservices": "^10.2.10", + "@nestjs/swagger": "^7.1.16", "axios": "^1.6.2", + "class-transformer": "^0.5.1", + "class-validator": "^0.14.0", "joi": "^17.6.0", "nats": "^2.18.0", "rxjs": "^7.2.0", diff --git a/apps/shared/src/dto/multitenancy-params.dto.ts b/apps/shared/src/dto/multitenancy-params.dto.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6dc7c07618fdd19219ed1606761baaf365b0691 --- /dev/null +++ b/apps/shared/src/dto/multitenancy-params.dto.ts @@ -0,0 +1,12 @@ +import { ApiProperty } from '@nestjs/swagger'; +import { IsNotEmpty, IsString } from 'class-validator'; + +export class MultitenancyParams { + @IsString() + @IsNotEmpty() + @ApiProperty({ + required: true, + description: 'Specifies the tenant ID', + }) + public tenantId: string; +} diff --git a/apps/shared/src/dto/pagination-params.dto.ts b/apps/shared/src/dto/pagination-params.dto.ts new file mode 100644 index 0000000000000000000000000000000000000000..262663e907fcc73f9c03a1f11210d9a42228f8b7 --- /dev/null +++ b/apps/shared/src/dto/pagination-params.dto.ts @@ -0,0 +1,26 @@ +import { ApiProperty } from '@nestjs/swagger'; +import { Type } from 'class-transformer'; +import { IsNumber, IsOptional, Min } from 'class-validator'; + +export class PaginationParams { + @IsNumber() + @Min(1) + @Type(() => Number) + @IsOptional() + @ApiProperty({ + required: false, + description: 'Specifies the page number of a result set', + }) + public page?: number; + + @IsNumber() + @Min(1) + @Type(() => Number) + @IsOptional() + @ApiProperty({ + required: false, + description: + 'Specifies the number of items to return in a single page of a result set', + }) + public pageSize?: number; +} diff --git a/apps/shared/src/index.ts b/apps/shared/src/index.ts index 8fa24d341f31ec9e1d424ae5b860438608c4d807..d05de3dc2617f6cef96f953cd79974fa6c8d641b 100644 --- a/apps/shared/src/index.ts +++ b/apps/shared/src/index.ts @@ -9,3 +9,6 @@ export * from './events/didEvents.js'; export * from './events/tenantEvents.js'; export * from './events/schemaEvents.js'; export * from './events/credentialDefinitionEvents.js'; + +export * from './dto/pagination-params.dto.js'; +export * from './dto/multitenancy-params.dto.js';