Skip to content

Commit

Permalink
[BE#262] 이미지 변경에 대해 patch를 post로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
yeongbinim authored Nov 29, 2023
1 parent 002488a commit 50ad022
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions BE/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
Res,
Post,
Body,
Patch,
UseInterceptors,
UploadedFile,
BadRequestException,
Expand Down Expand Up @@ -65,7 +64,7 @@ export class AuthController {
res.redirect('/');
}

@Patch('info')
@Post('info')
@UseGuards(AccessTokenGuard)
@UseInterceptors(FileInterceptor('image'))
@ApiOperation({ summary: '유저 정보 설정 (완)' })
Expand All @@ -80,6 +79,7 @@ export class AuthController {
@UploadedFile() file: Express.Multer.File,
): Promise<any> {
let image_url: string;
console.log(file);
if (file) {
const isNomal = await this.usersService.isNormalImage(file);
if (!isNomal) {
Expand All @@ -95,10 +95,12 @@ export class AuthController {
return {
nickname: updatedUser.nickname,
email: updatedUser.email,
image_url: path.join(
this.configService.get(ENV.CDN_ENDPOINT),
updatedUser.image_url,
),
image_url: updatedUser.image_url
? path.join(
this.configService.get(ENV.CDN_ENDPOINT),
updatedUser.image_url,
)
: null,
};
}

Expand All @@ -114,10 +116,9 @@ export class AuthController {
return {
nickname: user.nickname,
email: user.email,
image_url: path.join(
this.configService.get(ENV.CDN_ENDPOINT),
user.image_url ?? 'default.png',
),
image_url: user.image_url
? path.join(this.configService.get(ENV.CDN_ENDPOINT), user.image_url)
: null,
};
}
}

0 comments on commit 50ad022

Please sign in to comment.