فهرست منبع

fix: 接口错误映射

IlhamTahir 1 سال پیش
والد
کامیت
e9dc22fde9
2فایلهای تغییر یافته به همراه16 افزوده شده و 7 حذف شده
  1. 9 5
      src/article/controller/carousal.controller.ts
  2. 7 2
      src/core/controller/file.controller.ts

+ 9 - 5
src/article/controller/carousal.controller.ts

@@ -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
src/core/controller/file.controller.ts

@@ -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,
   })