fix: 接口错误映射

This commit is contained in:
ilhamtahir committed 2024-11-21 16:10:21 +08:00
1 parent dd1cc2e3d7
commit e9dc22fde9
2 files changed
+16 -7

No files matched your search

@@ -3,6 +3,7 @@ import {
Controller,
Delete,
Get,
Param,
Post,
Put,
Query,
@@ -78,7 +79,7 @@ export class CarousalController {
@ApiOkResponse({
type: CarousalVo,
})
async get(id: string) {
async get(@Param('id') id: string) {
return CarousalMapper.toVo(await this.carousalService.get(id));
}
@@ -87,7 +88,10 @@ export class CarousalController {
@ApiOkResponse({
type: CarousalVo,
})
async update(id: string, updateCarousalRequest: UpdateCarousalRequest) {
async update(
@Param('id') id: string,
@Body() updateCarousalRequest: UpdateCarousalRequest,
) {
return CarousalMapper.toVo(
await this.carousalService.update(id, updateCarousalRequest),
);
@@ -98,7 +102,7 @@ export class CarousalController {
@ApiOkResponse({
type: CarousalVo,
})
async active(id: string) {
async active(@Param('id') id: string) {
return CarousalMapper.toVo(await this.carousalService.active(id));
}
@@ -107,13 +111,13 @@ export class CarousalController {
@ApiOkResponse({
type: CarousalVo,
})
async inactive(id: string) {
async inactive(@Param('id') id: string) {
return CarousalMapper.toVo(await this.carousalService.inactive(id));
}
@Delete(':id')
@ApiBearerAuth()
async delete(id: string) {
async delete(@Param('id') id: string) {
await this.carousalService.delete(id);
}
}
+7 -2
View File
@@ -5,9 +5,13 @@ import {
UseInterceptors,
} from '@nestjs/common';
import { FileInterceptor } from '@nestjs/platform-express';
import { ApiBody, ApiConsumes, ApiOkResponse } from '@nestjs/swagger';
import {
ApiBearerAuth,
ApiBody,
ApiConsumes,
ApiOkResponse,
} from '@nestjs/swagger';
import { FileService } from '../service/file.service';
import { NoAuth } from '../decorators/no-auth.decorator';
import { FileVo } from '../vo/file.vo';
@Controller('files')
@@ -24,6 +28,7 @@ export class FileController {
},
},
})
@ApiBearerAuth()
@ApiOkResponse({
type: FileVo,
})