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