GeezerVison is showing github.com — [fix] mypage comment 없을 때 response body 수정 / 회원정보 수정 requeset body 수정 · Team-O2/Back-end2@7a2e49d
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/DTO/userDTO.ts +8-1Lines changed: 8 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -83,9 +83,16 @@ namespace userDTO { | 83 | 83 | challengeNum: number; | 84 | 84 | } | 85 | 85 |
| | 86 | + // export interface userInfoReqDTO { | | 87 | + // nickname: string; | | 88 | + // interest: string[]; | | 89 | + // isMarketing: Boolean; | | 90 | + // img?: File; | | 91 | + // } | | 92 | + | 86 | 93 | export interface userInfoReqDTO { | 87 | 94 | nickname: string; | 88 | | - interest: string[]; | | 95 | + interest: string; | 89 | 96 | isMarketing: Boolean; | 90 | 97 | img?: File; | 91 | 98 | } | |
Collapse file Copy file name to clipboardExpand all lines: src/controller/user.ts +8-8Lines changed: 8 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -221,14 +221,14 @@ const getMyCommentsController = async (req: Request, res: Response) => { | 221 | 221 | "잘못된 postModel 값입니다." | 222 | 222 | ); | 223 | 223 | } | 224 | | - // 3. 작성한 댓글이 없을 때 | 225 | | - else if (data === -3) { | 226 | | - response.basicResponse( | 227 | | - res, | 228 | | - returnCode.NO_CONTENT, | 229 | | - "작성한 댓글이 없습니다." | 230 | | - ); | 231 | | - } | | 224 | + // // 3. 작성한 댓글이 없을 때 | | 225 | + // else if (data === -3) { | | 226 | + // response.basicResponse( | | 227 | + // res, | | 228 | + // returnCode.NO_CONTENT, | | 229 | + // "작성한 댓글이 없습니다." | | 230 | + // ); | | 231 | + // } | 232 | 232 | // 4. 내가 쓴 댓글 조회 성공 | 233 | 233 | else { | 234 | 234 | response.dataResponse( | |
Collapse file Copy file name to clipboardExpand all lines: src/service/userService.ts +11-11Lines changed: 11 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -17,7 +17,7 @@ import period from "../library/date"; | 17 | 17 | import jwt from "jsonwebtoken"; | 18 | 18 | import bcrypt from "bcryptjs"; | 19 | 19 | import config from "../config"; | 20 | | -import { emailSender } from "../library"; | | 20 | +import { emailSender, array } from "../library"; | 21 | 21 | import ejs from "ejs"; | 22 | 22 | import { ConnectionTimedOutError, Op, QueryTypes, Sequelize } from "sequelize"; | 23 | 23 | // DTO | @@ -157,7 +157,7 @@ const getUserInfo = async (userID: number) => { | 157 | 157 | const user = await User.findOne({ | 158 | 158 | where: { | 159 | 159 | id: userID, | 160 | | - }, | | 160 | + }, | 161 | 161 | attributes: ["isMarketing", "img", "id", "email", "nickname", "interest"], | 162 | 162 | }); | 163 | 163 |
| @@ -724,11 +724,11 @@ const getMyComments = async ( | 724 | 724 | if (!commentList) { | 725 | 725 | return -2; | 726 | 726 | } | 727 | | - // 3. 작성한 댓글이 없을 떄 | 728 | | - else if (!commentList.length) { | 729 | | - // console.log(challengeList.length); | 730 | | - return -3; | 731 | | - } | | 727 | + // // 3. 작성한 댓글이 없을 떄 | | 728 | + // else if (!commentList.length) { | | 729 | + // // console.log(challengeList.length); | | 730 | + // return -3; | | 731 | + // } | 732 | 732 |
| 733 | 733 | const commentNum = commentList.length; | 734 | 734 |
| @@ -1015,7 +1015,8 @@ const patchUserInfo = async ( | 1015 | 1015 | body: userDTO.userInfoReqDTO, | 1016 | 1016 | url? | 1017 | 1017 | ) => { | 1018 | | - let { nickname, interest, isMarketing } = body; | | 1018 | + let { nickname, isMarketing } = body; | | 1019 | + let interest = array.stringToInterest(body.interest); | 1019 | 1020 |
| 1020 | 1021 | // 1. 요청 바디 부족 | 1021 | 1022 | if ( | @@ -1033,7 +1034,6 @@ const patchUserInfo = async ( | 1033 | 1034 | return -2; | 1034 | 1035 | } | 1035 | 1036 |
| 1036 | | - let newInterest = ""; | 1037 | 1037 | const user = await User.findOne({ | 1038 | 1038 | where: { id: userID }, | 1039 | 1039 | }); | @@ -1043,7 +1043,7 @@ const patchUserInfo = async ( | 1043 | 1043 | await User.update( | 1044 | 1044 | { | 1045 | 1045 | nickname, | 1046 | | - interest: interest.join(), | | 1046 | + interest, | 1047 | 1047 | isMarketing, | 1048 | 1048 | img: url.img, | 1049 | 1049 | }, | @@ -1053,7 +1053,7 @@ const patchUserInfo = async ( | 1053 | 1053 | await User.update( | 1054 | 1054 | { | 1055 | 1055 | nickname, | 1056 | | - interest: interest.join(), | | 1056 | + interest: interest, | 1057 | 1057 | isMarketing, | 1058 | 1058 | }, | 1059 | 1059 | { where: { id: userID } } | |
|