feat(v2.4): 切换测试与缺陷主写
This commit is contained in:
43
apps/server/src/modules/test-case/test-case.controller.ts
Normal file
43
apps/server/src/modules/test-case/test-case.controller.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common';
|
||||
import { CreateTestCaseDto } from './dto/create-test-case.dto';
|
||||
import { UpdateTestCaseDto } from './dto/update-test-case.dto';
|
||||
import { TestCaseService } from './test-case.service';
|
||||
|
||||
@Controller('versions/:versionId/test-cases')
|
||||
export class TestCaseController {
|
||||
constructor(private readonly testCaseService: TestCaseService) {}
|
||||
|
||||
@Post()
|
||||
create(@Param('versionId') versionId: string, @Body() dto: CreateTestCaseDto) {
|
||||
return this.testCaseService.create(versionId, dto);
|
||||
}
|
||||
|
||||
@Post('batch')
|
||||
createMany(@Param('versionId') versionId: string, @Body('items') items: CreateTestCaseDto[]) {
|
||||
return this.testCaseService.createMany(versionId, items ?? []);
|
||||
}
|
||||
|
||||
@Get()
|
||||
findAll(@Param('versionId') versionId: string) {
|
||||
return this.testCaseService.findAll(versionId);
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
update(@Param('versionId') versionId: string, @Param('id') id: string, @Body() dto: UpdateTestCaseDto) {
|
||||
return this.testCaseService.update(versionId, id, dto);
|
||||
}
|
||||
|
||||
@Patch(':id/status')
|
||||
updateStatus(
|
||||
@Param('versionId') versionId: string,
|
||||
@Param('id') id: string,
|
||||
@Body('status') status: string,
|
||||
) {
|
||||
return this.testCaseService.updateStatus(versionId, id, status);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
remove(@Param('versionId') versionId: string, @Param('id') id: string) {
|
||||
return this.testCaseService.remove(versionId, id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user