dto.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. description: 'Milvus collection name',
  16. })
  17. @IsString()
  18. @IsNotEmpty({
  19. message: 'collection_name is empty',
  20. })
  21. readonly collection_name: string;
  22. }
  23. export class ManagePartition {
  24. @ApiProperty({
  25. description: 'Milvus collection name',
  26. })
  27. @IsString()
  28. @IsNotEmpty({
  29. message: 'collection_name is empty',
  30. })
  31. readonly collection_name: string;
  32. @ApiProperty({
  33. description: 'Milvus partition name',
  34. })
  35. @IsString()
  36. @IsNotEmpty({
  37. message: 'partition_name is empty',
  38. })
  39. readonly partition_name: string;
  40. @ApiProperty({
  41. description: 'Type allow delete and create',
  42. enum: ManageType
  43. })
  44. @IsEnum(ManageType, { message: 'Type allow delete and create' })
  45. readonly type: ManageType;
  46. }
  47. export class LoadPartitions {
  48. @ApiProperty({
  49. description: 'Milvus collection name',
  50. })
  51. @IsString()
  52. @IsNotEmpty({
  53. message: 'collection_name is empty',
  54. })
  55. readonly collection_name: string;
  56. @ApiProperty({
  57. description: 'Milvus partition name',
  58. })
  59. @IsArray()
  60. @ArrayNotEmpty()
  61. @IsNotEmpty({
  62. message: 'partition_names is empty',
  63. })
  64. readonly partition_names: string[];
  65. }