Skip to content

Commit

Permalink
Merge pull request #208 from Gamegoo-repo/refactor/207
Browse files Browse the repository at this point in the history
[Refactor/207] ์ฑ„ํŒ… API์— ํƒˆํ‡ด ๊ด€๋ จ ๋กœ์ง ์ถ”๊ฐ€
  • Loading branch information
Eunjin3395 authored Sep 8, 2024
2 parents 8282fca + ecdb706 commit aa5c454
Show file tree
Hide file tree
Showing 5 changed files with 201 additions and 99 deletions.
35 changes: 25 additions & 10 deletions src/main/java/com/gamegoo/apiPayload/code/status/ErrorStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public enum ErrorStatus implements BaseErrorCode {

// ๋งค์นญ ๊ด€๋ จ ์—๋Ÿฌ
MATCHING_STATUS_BAD_REQUEST(HttpStatus.BAD_REQUEST, "MATCH400",
"status๋Š” SUCCESS, FAIL ๋‘˜ ์ค‘ ํ•˜๋‚˜๋กœ๋งŒ ๋ณ€๊ฒฝ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
"status๋Š” SUCCESS, FAIL ๋‘˜ ์ค‘ ํ•˜๋‚˜๋กœ๋งŒ ๋ณ€๊ฒฝ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
MATHCING_TYPE_BAD_REQUEST(HttpStatus.BAD_REQUEST, "MATCH401",
"matchingType์€ BASIC, PRECISE ๋‘˜ ์ค‘ ํ•˜๋‚˜์—ฌ์•ผํ•ฉ๋‹ˆ๋‹ค."),
"matchingType์€ BASIC, PRECISE ๋‘˜ ์ค‘ ํ•˜๋‚˜์—ฌ์•ผํ•ฉ๋‹ˆ๋‹ค."),
MATCHING_NOT_FOUND(HttpStatus.NOT_FOUND, "MATCH402", "ํ•ด๋‹น ์‚ฌ์šฉ์ž์˜ ๋งค์นญ ์ •๋ณด๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค."),
MATCHING_FAILED_BY_BLOCK(HttpStatus.BAD_REQUEST, "MATCH403", "์ฐจ๋‹จ๋œ ์‚ฌ์šฉ์ž๋ผ๋ฆฌ์˜ ๋งค์นญ์€ ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),

Expand Down Expand Up @@ -110,19 +110,34 @@ public enum ErrorStatus implements BaseErrorCode {
MANNER_INSERT_BAD_REQUEST(HttpStatus.BAD_REQUEST, "MANNER410", "์ž˜๋ชป๋œ ๋งค๋„ˆํ‰๊ฐ€ ๋“ฑ๋ก ์š”์ฒญ์ž…๋‹ˆ๋‹ค."),

// ์ฑ„ํŒ… ๊ด€๋ จ ์—๋Ÿฌ
CHAT_TARGET_NOT_FOUND(HttpStatus.NOT_FOUND, "CHAT401", "์ฑ„ํŒ… ๋Œ€์ƒ ํšŒ์›์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."),
CHAT_START_FAILED_CHAT_TARGET_NOT_FOUND(HttpStatus.NOT_FOUND, "CHAT401",
"์ฑ„ํŒ… ๋Œ€์ƒ ํšŒ์›์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."),
CHATROOM_NOT_EXIST(HttpStatus.NOT_FOUND, "CHAT402", "์ฑ„ํŒ…๋ฐฉ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."),
CHATROOM_ACCESS_DENIED(HttpStatus.BAD_REQUEST, "CHAT403", "์ ‘๊ทผํ•  ์ˆ˜ ์—†๋Š” ์ฑ„ํŒ…๋ฐฉ ์ž…๋‹ˆ๋‹ค."),
CHAT_MESSAGE_NOT_FOUND(HttpStatus.NOT_FOUND, "CHAT404", "ํ•ด๋‹น ๋ฉ”์‹œ์ง€๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"),
CHAT_TARGET_IS_BLOCKED_CHAT_START_FAILED(HttpStatus.FORBIDDEN, "CHAT405",
CHAT_START_FAILED_CHAT_TARGET_IS_BLOCKED(HttpStatus.FORBIDDEN, "CHAT405",
"์ฑ„ํŒ… ์ƒ๋Œ€ ํšŒ์›์„ ์ฐจ๋‹จํ•œ ์ƒํƒœ์ž…๋‹ˆ๋‹ค. ์ฑ„ํŒ… ์‹œ์ž‘์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
BLOCKED_BY_CHAT_TARGET_CHAT_START_FAILED(HttpStatus.FORBIDDEN, "CHAT406",
CHAT_START_FAILED_BLOCKED_BY_CHAT_TARGET(HttpStatus.FORBIDDEN, "CHAT406",
"์ฑ„ํŒ… ์ƒ๋Œ€ ํšŒ์›์ด ๋‚˜๋ฅผ ์ฐจ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค. ์ฑ„ํŒ… ์‹œ์ž‘์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
CHAT_TARGET_IS_BLOCKED_SEND_CHAT_FAILED(HttpStatus.FORBIDDEN, "CHAT407",
CHAT_START_FAILED_TARGET_USER_DEACTIVATED(HttpStatus.NOT_FOUND, "CHAT407",
"์ฑ„ํŒ… ์ƒ๋Œ€ ํšŒ์›์ด ํƒˆํ‡ดํ–ˆ์Šต๋‹ˆ๋‹ค. ์ฑ„ํŒ… ์‹œ์ž‘์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
CHAT_START_FAILED_BOARD_NOT_FOUND(HttpStatus.NOT_FOUND, "CHAT408",
"ํ•ด๋‹น ๊ฒŒ์‹œ๊ธ€์ด ์กด์žฌํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ฑ„ํŒ… ์‹œ์ž‘์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
CHAT_START_FAILED_BOARD_CREATOR_IS_SELF(HttpStatus.BAD_REQUEST, "CHAT409",
"ํ•ด๋‹น ๊ฒŒ์‹œ๊ธ€์˜ ์ž‘์„ฑ์ž๊ฐ€ ๋ณธ์ธ์ž…๋‹ˆ๋‹ค. ์ฑ„ํŒ… ์‹œ์ž‘์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
CHAT_START_FAILED_TARGET_USER_IS_SELF(HttpStatus.BAD_REQUEST, "CHAT410",
"์ฑ„ํŒ… ๋Œ€์ƒ ํšŒ์›์ด ๋ณธ์ธ์ž…๋‹ˆ๋‹ค. ์ฑ„ํŒ… ์‹œ์ž‘์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
CHAT_READ_FAILED_NOT_ENTERED_CHATROOM(HttpStatus.FORBIDDEN, "CHAT411",
"ํ•ด๋‹น ์ฑ„ํŒ…๋ฐฉ์— ์ž…์žฅ ์ƒํƒœ๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค. ์ฑ„ํŒ…๋ฐฉ ์ž…์žฅ ํ›„ ๋ฉ”์‹œ์ง€ ์ฝ์Œ ์ฒ˜๋ฆฌํ•˜์„ธ์š”."),
CHAT_READ_FAILED_CHAT_MESSAGE_NOT_FOUND(HttpStatus.NOT_FOUND, "CHAT412",
"ํ•ด๋‹น ๋ฉ”์‹œ์ง€๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€ ์ฝ์Œ ์ฒ˜๋ฆฌ ์‹คํŒจ"),
CHAT_ADD_FAILED_TARGET_USER_DEACTIVATED(HttpStatus.BAD_REQUEST, "CHAT413",
"์ฑ„ํŒ… ์ƒ๋Œ€ ํšŒ์›์ด ํƒˆํ‡ดํ–ˆ์Šต๋‹ˆ๋‹ค. ์ฑ„ํŒ… ์ „์†ก์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
CHAT_ADD_FAILED_CHAT_TARGET_IS_BLOCKED(HttpStatus.FORBIDDEN, "CHAT408",
"์ฑ„ํŒ… ์ƒ๋Œ€ ํšŒ์›์„ ์ฐจ๋‹จํ•œ ์ƒํƒœ์ž…๋‹ˆ๋‹ค. ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€ ์ „์†ก์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
BLOCKED_BY_CHAT_TARGET_SEND_CHAT_FAILED(HttpStatus.FORBIDDEN, "CHAT408",
CHAT_ADD_FAILED_BLOCKED_BY_CHAT_TARGET(HttpStatus.FORBIDDEN, "CHAT409",
"์ฑ„ํŒ… ์ƒ๋Œ€ ํšŒ์›์ด ๋‚˜๋ฅผ ์ฐจ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค. ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€ ์ „์†ก์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค."),
CHAT_TARGET_MEMBER_ID_INVALID(HttpStatus.BAD_REQUEST, "CHAT409", "์ฑ„ํŒ…๋ฐฉ ์‹œ์ž‘ ๋Œ€์ƒ ํšŒ์› id ๊ฐ’์ด ์ž˜๋ชป๋˜์—ˆ์Šต๋‹ˆ๋‹ค."),


// ์นœ๊ตฌ ๊ด€๋ จ ์—๋Ÿฌ
FRIEND_BAD_REQUEST(HttpStatus.BAD_REQUEST, "FRIEND401", "์ž˜๋ชป๋œ ์นœ๊ตฌ ์š”์ฒญ์ž…๋‹ˆ๋‹ค."),
Expand All @@ -135,9 +150,9 @@ public enum ErrorStatus implements BaseErrorCode {
TARGET_PENDING_FRIEND_REQUEST_EXIST(HttpStatus.BAD_REQUEST, "FRIEND405",
"ํ•ด๋‹น ํšŒ์›์ด ๋‚˜์—๊ฒŒ ๋ณด๋‚ธ ์นœ๊ตฌ ์š”์ฒญ์ด ์ˆ˜๋ฝ ๋Œ€๊ธฐ ์ค‘ ์ž…๋‹ˆ๋‹ค. ํ•ด๋‹น ์š”์ฒญ์„ ์ˆ˜๋ฝ ํ•ด์ฃผ์„ธ์š”."),
ALREADY_FRIEND(HttpStatus.BAD_REQUEST, "FRIEND406",
"๋‘ ํšŒ์›์€ ์ด๋ฏธ ์นœ๊ตฌ ๊ด€๊ณ„ ์ž…๋‹ˆ๋‹ค. ์นœ๊ตฌ ์š”์ฒญ์„ ๋ณด๋‚ผ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."),
"๋‘ ํšŒ์›์€ ์ด๋ฏธ ์นœ๊ตฌ ๊ด€๊ณ„ ์ž…๋‹ˆ๋‹ค. ์นœ๊ตฌ ์š”์ฒญ์„ ๋ณด๋‚ผ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค."),
PENDING_FRIEND_REQUEST_NOT_EXIST(HttpStatus.NOT_FOUND, "FRIEND407",
"์ทจ์†Œ/์ˆ˜๋ฝ/๊ฑฐ์ ˆํ•  ์นœ๊ตฌ ์š”์ฒญ์ด ์กด์žฌํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค."),
"์ทจ์†Œ/์ˆ˜๋ฝ/๊ฑฐ์ ˆํ•  ์นœ๊ตฌ ์š”์ฒญ์ด ์กด์žฌํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค."),
MEMBERS_NOT_FRIEND(HttpStatus.BAD_REQUEST, "FRIEND408", "๋‘ ํšŒ์›์€ ์นœ๊ตฌ ๊ด€๊ณ„๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค."),
ALREADY_STAR_FRIEND(HttpStatus.BAD_REQUEST, "FRIEND409", "์ด๋ฏธ ์ฆ๊ฒจ์ฐพ๊ธฐ ๋˜์–ด ์žˆ๋Š” ์นœ๊ตฌ์ž…๋‹ˆ๋‹ค."),
NOT_STAR_FRIEND(HttpStatus.BAD_REQUEST, "FRIEND410", "์ฆ๊ฒจ์ฐพ๊ธฐ ๋˜์–ด ์žˆ๋Š” ์นœ๊ตฌ๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค."),
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/gamegoo/converter/ChatConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public static ChatResponse.ChatMessageDTO toChatMessageDto(Chat chat) {

return ChatResponse.ChatMessageDTO.builder()
.senderId(chat.getFromMember().getId())
.senderName(chat.getFromMember().getGameName())
.senderName(
chat.getFromMember().getBlind() ? "(ํƒˆํ‡ดํ•œ ์‚ฌ์šฉ์ž)" : chat.getFromMember().getGameName())
.senderProfileImg(chat.getFromMember().getProfileImage())
.message(chat.getContents())
.createdAt(DatetimeUtil.toKSTString(chat.getCreatedAt()))
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/gamegoo/dto/chat/ChatResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static class ChatroomViewDTO {
String targetMemberName;
Boolean friend;
Boolean blocked;
Boolean blind;
Long friendRequestMemberId;
String lastMsg;
String lastMsgAt;
Expand All @@ -40,6 +41,7 @@ public static class ChatroomViewDTO {
"memberProfileImg",
"friend",
"blocked",
"blind",
"friendRequestMemberId",
"system",
"chatMessageList"
Expand All @@ -52,6 +54,7 @@ public static class ChatroomEnterDTO {
Integer memberProfileImg;
Boolean friend;
Boolean blocked;
Boolean blind;
Long friendRequestMemberId;
SystemFlagDTO system;
ChatMessageListDTO chatMessageList;
Expand Down
Loading

0 comments on commit aa5c454

Please sign in to comment.