Loading backend/src/town/town.controller.ts +3 −1 Original line number Diff line number Diff line import { Controller, Get, Post, Param, Delete, UseInterceptors, UploadedFile, Body } from '@nestjs/common'; import { TownService } from './town.service'; import { ApiTags } from '@nestjs/swagger'; import { ApiBody, ApiConsumes, ApiTags } from '@nestjs/swagger'; import { FileValidationPipe } from 'src/shared/pipe/file-validation.pipe'; import { fileInterceptor } from 'src/shared/interceptors/file-save.interceptor'; import { CreateTownDto } from './dto/create-town.dto'; Loading @@ -9,6 +9,8 @@ import { CreateTownDto } from './dto/create-town.dto'; export class TownController { constructor(private readonly townService: TownService) {} @ApiBody({ type: CreateTownDto }) @ApiConsumes('multipart/form-data') @Post() @UseInterceptors(fileInterceptor('image', 'static/towns/', ['.jpg', '.jpeg', '.png'])) async create(@UploadedFile(new FileValidationPipe()) file, @Body() createTownDto: CreateTownDto) { Loading Loading
backend/src/town/town.controller.ts +3 −1 Original line number Diff line number Diff line import { Controller, Get, Post, Param, Delete, UseInterceptors, UploadedFile, Body } from '@nestjs/common'; import { TownService } from './town.service'; import { ApiTags } from '@nestjs/swagger'; import { ApiBody, ApiConsumes, ApiTags } from '@nestjs/swagger'; import { FileValidationPipe } from 'src/shared/pipe/file-validation.pipe'; import { fileInterceptor } from 'src/shared/interceptors/file-save.interceptor'; import { CreateTownDto } from './dto/create-town.dto'; Loading @@ -9,6 +9,8 @@ import { CreateTownDto } from './dto/create-town.dto'; export class TownController { constructor(private readonly townService: TownService) {} @ApiBody({ type: CreateTownDto }) @ApiConsumes('multipart/form-data') @Post() @UseInterceptors(fileInterceptor('image', 'static/towns/', ['.jpg', '.jpeg', '.png'])) async create(@UploadedFile(new FileValidationPipe()) file, @Body() createTownDto: CreateTownDto) { Loading