dto.ts 948 B

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