|
@@ -1,11 +1,19 @@
|
|
import {
|
|
import {
|
|
|
|
+ Body,
|
|
Controller,
|
|
Controller,
|
|
Get,
|
|
Get,
|
|
|
|
+ Post,
|
|
|
|
+ Put,
|
|
Query,
|
|
Query,
|
|
UsePipes,
|
|
UsePipes,
|
|
ValidationPipe,
|
|
ValidationPipe,
|
|
} from '@nestjs/common';
|
|
} from '@nestjs/common';
|
|
-import { GetPartitionsInfo } from './dto';
|
|
|
|
|
|
+import {
|
|
|
|
+ GetPartitionsInfo,
|
|
|
|
+ LoadPartitions,
|
|
|
|
+ ManagePartition,
|
|
|
|
+ ManageType,
|
|
|
|
+} from './dto';
|
|
import { PartitionsService } from './partitions.service';
|
|
import { PartitionsService } from './partitions.service';
|
|
|
|
|
|
@Controller('partitions')
|
|
@Controller('partitions')
|
|
@@ -17,4 +25,26 @@ export class PartitionsController {
|
|
async getPartitions(@Query() query: GetPartitionsInfo) {
|
|
async getPartitions(@Query() query: GetPartitionsInfo) {
|
|
return await this.partitionsService.getPatitionsInfo(query);
|
|
return await this.partitionsService.getPatitionsInfo(query);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Post()
|
|
|
|
+ @UsePipes(new ValidationPipe())
|
|
|
|
+ async managePartition(@Body() body: ManagePartition) {
|
|
|
|
+ const { type, ...params } = body;
|
|
|
|
+
|
|
|
|
+ return type.toLocaleLowerCase() === ManageType.CREATE
|
|
|
|
+ ? await this.partitionsService.createParition(params)
|
|
|
|
+ : await this.partitionsService.deleteParition(params);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Put('load')
|
|
|
|
+ @UsePipes(new ValidationPipe())
|
|
|
|
+ async loadPartition(@Body() body: LoadPartitions) {
|
|
|
|
+ return await this.partitionsService.loadPartitions(body);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Put('release')
|
|
|
|
+ @UsePipes(new ValidationPipe())
|
|
|
|
+ async releasePartitions(@Body() body: LoadPartitions) {
|
|
|
|
+ return await this.partitionsService.loadPartitions(body);
|
|
|
|
+ }
|
|
}
|
|
}
|