Enhances Swagger API documentation and response consistency

Adds comprehensive Swagger decorators across App, Account, and Image controllers to improve API endpoint clarity and detail. This includes adding API tags, operation summaries, response types, authentication requirements, and specific schema for file uploads.

Standardizes error responses within the Page module by introducing a consistent `ErrorResponseDto` for bad requests, not found errors, and unauthorized access. Also refactors the `getPage` endpoint to return a `PageListResponseDto`, ensuring uniform list responses.

Updates DTO definitions in `page.service.ts` with explicit types and nullability for improved accuracy in generated documentation.
This commit is contained in:
dahyeon committed 2025-11-11 17:14:14 +00:00
1 parent de24f0dd3f
commit 815d44c161
6 files changed
+272 -49

No files matched your search

+16
View File
@@ -1,13 +1,29 @@
import { Controller, Post, UploadedFile, UseInterceptors } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiResponse, ApiConsumes, ApiBody } from '@nestjs/swagger';
import { ImageService } from './image.service';
import { FileInterceptor } from '@nestjs/platform-express';
@ApiTags('Image')
@Controller('image')
export class ImageController {
constructor(private readonly imageService: ImageService) {}
@Post()
@UseInterceptors(FileInterceptor('file'))
@ApiOperation({ summary: '이미지 업로드', description: '이미지 파일을 업로드합니다' })
@ApiConsumes('multipart/form-data')
@ApiBody({
schema: {
type: 'object',
properties: {
file: {
type: 'string',
format: 'binary',
},
},
},
})
@ApiResponse({ status: 201, description: '이미지 업로드 성공', type: String })
async uploadImage(@UploadedFile() file: Express.Multer.File) {
return this.imageService.uploadImage(file)
}