Skip to content

Commit

Permalink
Merge pull request #42 from Team-O2/feat/#22
Browse files Browse the repository at this point in the history
Feat/#22
  • Loading branch information
xxeol2 authored Sep 24, 2021
2 parents 7d4c5dc + 9fba9bb commit be8e47c
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/service/userService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ["일", "월", "화", "수", "목", "금", "토"];

Expand Down Expand Up @@ -1026,6 +1027,7 @@ const patchUserInfo = async (
) {
return -1;
}

const nicknameUser = await User.findOne({
where: { nickname, id: { [Op.ne]: userID } },
});
Expand All @@ -1034,10 +1036,6 @@ const patchUserInfo = async (
return -2;
}

const user = await User.findOne({
where: { id: userID },
});

// 이미지 변경이 존재하는 경우
if (url && url.img !== "") {
await User.update(
Expand All @@ -1056,18 +1054,28 @@ 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 } });
}

const resData: userDTO.userInfoResDTO = {
interest: interest.split(","),
isMarketing,
img: url.img,
img: user.img,
id: userID,
email: user.email,
nickname
Expand Down

0 comments on commit be8e47c

Please sign in to comment.