|
@@ -6,6 +6,7 @@ import {
|
|
Query,
|
|
Query,
|
|
UsePipes,
|
|
UsePipes,
|
|
ValidationPipe,
|
|
ValidationPipe,
|
|
|
|
+ UseInterceptors,
|
|
} from '@nestjs/common';
|
|
} from '@nestjs/common';
|
|
import { ApiTags } from '@nestjs/swagger';
|
|
import { ApiTags } from '@nestjs/swagger';
|
|
import {
|
|
import {
|
|
@@ -16,11 +17,12 @@ import {
|
|
GetIndexState,
|
|
GetIndexState,
|
|
} from './dto';
|
|
} from './dto';
|
|
import { SchemaService } from './schema.service';
|
|
import { SchemaService } from './schema.service';
|
|
-
|
|
|
|
|
|
+import { LoggingInterceptor } from '../interceptors/index';
|
|
@ApiTags('schema')
|
|
@ApiTags('schema')
|
|
@Controller('schema')
|
|
@Controller('schema')
|
|
|
|
+@UseInterceptors(LoggingInterceptor)
|
|
export class SchemaController {
|
|
export class SchemaController {
|
|
- constructor(private schemaService: SchemaService) {}
|
|
|
|
|
|
+ constructor(private schemaService: SchemaService) { }
|
|
|
|
|
|
@Post('index')
|
|
@Post('index')
|
|
@UsePipes(new ValidationPipe())
|
|
@UsePipes(new ValidationPipe())
|
|
@@ -28,10 +30,10 @@ export class SchemaController {
|
|
const { type, collection_name, extra_params, field_name } = body;
|
|
const { type, collection_name, extra_params, field_name } = body;
|
|
return type === ManageType.CREATE
|
|
return type === ManageType.CREATE
|
|
? await this.schemaService.createIndex({
|
|
? await this.schemaService.createIndex({
|
|
- collection_name,
|
|
|
|
- extra_params,
|
|
|
|
- field_name,
|
|
|
|
- })
|
|
|
|
|
|
+ collection_name,
|
|
|
|
+ extra_params,
|
|
|
|
+ field_name,
|
|
|
|
+ })
|
|
: await this.schemaService.dropIndex({ collection_name, field_name });
|
|
: await this.schemaService.dropIndex({ collection_name, field_name });
|
|
}
|
|
}
|
|
|
|
|