From 4742a01865f4bdad1c9cbf54e75cd3d8b1771b99 Mon Sep 17 00:00:00 2001 From: xxeol2 <71129059+xxeol2@users.noreply.github.com> Date: Fri, 24 Sep 2021 16:26:49 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=ED=9A=8C=EC=9B=90=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20response=20body=20img=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/userService.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/service/userService.ts b/src/service/userService.ts index 5145e96..10836ee 100644 --- a/src/service/userService.ts +++ b/src/service/userService.ts @@ -28,6 +28,7 @@ import { getModels } from "sequelize-typescript"; import { userInfo } from "os"; import { CodeArtifact } from "aws-sdk"; import moment from "moment"; +import { json } from "stream/consumers"; const week = ["일", "월", "화", "수", "목", "금", "토"]; @@ -1026,6 +1027,7 @@ const patchUserInfo = async ( ) { return -1; } + const nicknameUser = await User.findOne({ where: { nickname, id: { [Op.ne]: userID } }, }); @@ -1034,10 +1036,6 @@ const patchUserInfo = async ( return -2; } - const user = await User.findOne({ - where: { id: userID }, - }); - // 이미지 변경이 존재하는 경우 if (url && url.img !== "") { await User.update( @@ -1056,10 +1054,20 @@ const patchUserInfo = async ( interest: interest, isMarketing, }, - { where: { id: userID } } + { + where: { id: userID }, + returning: true + }, ); } + const user = await User.findOne({ + where: { + id: userID, + }, + attributes: ["img", "email"] + }); + if (isMarketing) { await Badge.update({ marketingBadge: true }, { where: { id: userID } }); } @@ -1067,7 +1075,7 @@ const patchUserInfo = async ( const resData: userDTO.userInfoResDTO = { interest: interest.split(","), isMarketing, - img: url.img, + img: user.img, id: userID, email: user.email, nickname