From 50ad022a71ceef0e48a7e6d8552b2957b93847d9 Mon Sep 17 00:00:00 2001 From: Yeongbin Im <56269396+yeongbinim@users.noreply.github.com> Date: Wed, 29 Nov 2023 15:36:37 +0900 Subject: [PATCH] =?UTF-8?q?=20[BE#262]=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EC=97=90=20=EB=8C=80=ED=95=B4=20patch?= =?UTF-8?q?=EB=A5=BC=20post=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/auth/auth.controller.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/BE/src/auth/auth.controller.ts b/BE/src/auth/auth.controller.ts index eb3f971..0a495e0 100644 --- a/BE/src/auth/auth.controller.ts +++ b/BE/src/auth/auth.controller.ts @@ -7,7 +7,6 @@ import { Res, Post, Body, - Patch, UseInterceptors, UploadedFile, BadRequestException, @@ -65,7 +64,7 @@ export class AuthController { res.redirect('/'); } - @Patch('info') + @Post('info') @UseGuards(AccessTokenGuard) @UseInterceptors(FileInterceptor('image')) @ApiOperation({ summary: '유저 정보 설정 (완)' }) @@ -80,6 +79,7 @@ export class AuthController { @UploadedFile() file: Express.Multer.File, ): Promise { let image_url: string; + console.log(file); if (file) { const isNomal = await this.usersService.isNormalImage(file); if (!isNomal) { @@ -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, }; } @@ -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, }; } }