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