dto.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { ApiProperty } from '@nestjs/swagger';
  2. import {
  3. IsNotEmpty,
  4. IsString,
  5. IsEnum,
  6. IsArray,
  7. ArrayNotEmpty,
  8. } from 'class-validator';
  9. export enum ManageType {
  10. DELETE = 'delete',
  11. CREATE = 'create',
  12. }
  13. export class GetPartitionsInfo {
  14. @ApiProperty()
  15. @IsString()
  16. @IsNotEmpty({
  17. message: 'collection_name is empty',
  18. })
  19. readonly collection_name: string;
  20. }
  21. export class ManagePartition {
  22. @ApiProperty()
  23. @IsString()
  24. @IsNotEmpty({
  25. message: 'collection_name is empty',
  26. })
  27. readonly collection_name: string;
  28. @ApiProperty()
  29. @IsString()
  30. @IsNotEmpty({
  31. message: 'partition_name is empty',
  32. })
  33. readonly partition_name: string;
  34. @ApiProperty({ enum: ManageType })
  35. @IsEnum(ManageType, { message: 'Type allow delete and create' })
  36. readonly type: ManageType;
  37. }
  38. export class LoadPartitions {
  39. @ApiProperty()
  40. @IsString()
  41. @IsNotEmpty({
  42. message: 'collection_name is empty',
  43. })
  44. readonly collection_name: string;
  45. @ApiProperty()
  46. @IsArray()
  47. @ArrayNotEmpty()
  48. @IsNotEmpty({
  49. message: 'partition_names is empty',
  50. })
  51. readonly partition_names: string[];
  52. }