refactor(server): upload config (#3148)

This commit is contained in:
Jason Rasmussen
2023-07-09 00:37:40 -04:00
committed by GitHub
parent 8349a28ed8
commit 398bd04ffd
23 changed files with 473 additions and 624 deletions

View File

@@ -25,15 +25,14 @@ import {
UploadedFile,
UseInterceptors,
} from '@nestjs/common';
import { FileInterceptor } from '@nestjs/platform-express';
import { ApiBody, ApiConsumes, ApiTags } from '@nestjs/swagger';
import { Response as Res } from 'express';
import { AdminRoute, Authenticated, AuthUser, PublicRoute } from '../app.guard';
import { FileUploadInterceptor, Route } from '../app.interceptor';
import { UseValidation } from '../app.utils';
import { profileImageUploadOption } from '../config/profile-image-upload.config';
@ApiTags('User')
@Controller('user')
@Controller(Route.USER)
@Authenticated()
@UseValidation()
export class UserController {
@@ -83,12 +82,9 @@ export class UserController {
return this.service.updateUser(authUser, updateUserDto);
}
@UseInterceptors(FileInterceptor('file', profileImageUploadOption))
@UseInterceptors(FileUploadInterceptor)
@ApiConsumes('multipart/form-data')
@ApiBody({
description: 'A new avatar for the user',
type: CreateProfileImageDto,
})
@ApiBody({ description: 'A new avatar for the user', type: CreateProfileImageDto })
@Post('/profile-image')
createProfileImage(
@AuthUser() authUser: AuthUserDto,