import { FileService } from './file.service'
import { Controller, UploadedFile, UseInterceptors } from '@nestjs/common'
import { ApiTags } from '@nestjs/swagger'
import { Public } from '../auth/public.decorator'
import { Post } from '@nestjs/common'
import { FileInterceptor } from '@nestjs/platform-express'

@ApiTags('file')
@Controller('file')
export class FileController {
    constructor(private readonly fileService: FileService) {}

    @Public()
    @Post('upload')
    @UseInterceptors(FileInterceptor('file'))
    public async uploadFile(@UploadedFile() file: Express.Multer.File) {
        return await this.fileService.upload(file)
    }
}
