|
@@ -1,5 +1,11 @@
|
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|
|
-import { IsNotEmpty, IsString, IsArray } from 'class-validator';
|
|
|
+import {
|
|
|
+ IsNotEmpty,
|
|
|
+ IsString,
|
|
|
+ IsArray,
|
|
|
+ IsEnum,
|
|
|
+ IsOptional,
|
|
|
+} from 'class-validator';
|
|
|
|
|
|
class KeyValuePair {
|
|
|
@ApiProperty()
|
|
@@ -8,7 +14,16 @@ class KeyValuePair {
|
|
|
value: string;
|
|
|
}
|
|
|
|
|
|
-export class CreateIndex {
|
|
|
+export enum ManageType {
|
|
|
+ DELETE = 'delete',
|
|
|
+ CREATE = 'create',
|
|
|
+}
|
|
|
+
|
|
|
+export class ManageIndex {
|
|
|
+ @ApiProperty({ enum: ManageType })
|
|
|
+ @IsEnum(ManageType, { message: 'Type allow delete and create' })
|
|
|
+ readonly type: ManageType;
|
|
|
+
|
|
|
@ApiProperty()
|
|
|
@IsString()
|
|
|
@IsNotEmpty({
|
|
@@ -27,5 +42,55 @@ export class CreateIndex {
|
|
|
type: [KeyValuePair],
|
|
|
})
|
|
|
@IsArray()
|
|
|
- readonly extra_params: KeyValuePair[];
|
|
|
+ @IsOptional()
|
|
|
+ readonly extra_params?: KeyValuePair[];
|
|
|
+}
|
|
|
+
|
|
|
+export class DescribeIndex {
|
|
|
+ @ApiProperty()
|
|
|
+ @IsString()
|
|
|
+ @IsNotEmpty({
|
|
|
+ message: 'collection_name is empty',
|
|
|
+ })
|
|
|
+ readonly collection_name: string;
|
|
|
+
|
|
|
+ @ApiProperty()
|
|
|
+ @IsString()
|
|
|
+ @IsOptional()
|
|
|
+ readonly field_name?: string;
|
|
|
+}
|
|
|
+
|
|
|
+export class GetIndexState {
|
|
|
+ @ApiProperty()
|
|
|
+ @IsString()
|
|
|
+ @IsNotEmpty({
|
|
|
+ message: 'collection_name is empty',
|
|
|
+ })
|
|
|
+ readonly collection_name: string;
|
|
|
+
|
|
|
+ @ApiProperty()
|
|
|
+ @IsString()
|
|
|
+ @IsOptional()
|
|
|
+ readonly field_name?: string;
|
|
|
+}
|
|
|
+
|
|
|
+export class GetIndexProgress {
|
|
|
+ @ApiProperty()
|
|
|
+ @IsString()
|
|
|
+ @IsNotEmpty({
|
|
|
+ message: 'collection_name is empty',
|
|
|
+ })
|
|
|
+ readonly collection_name: string;
|
|
|
+
|
|
|
+ @ApiProperty()
|
|
|
+ @IsString()
|
|
|
+ @IsNotEmpty({
|
|
|
+ message: 'index_name is empty',
|
|
|
+ })
|
|
|
+ readonly index_name: string;
|
|
|
+
|
|
|
+ @ApiProperty()
|
|
|
+ @IsString()
|
|
|
+ @IsOptional()
|
|
|
+ readonly field_name?: string;
|
|
|
}
|