From 0b5f1ce2941d9d1ff4e70ab4b932ec39041d256b Mon Sep 17 00:00:00 2001 From: Lee Haewon Date: Thu, 8 Feb 2024 01:17:58 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B1=97=EB=B4=87=20=EB=8C=80=ED=99=94?= =?UTF-8?q?=20=EC=97=86=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20=EC=98=88=EC=99=B8?= =?UTF-8?q?=20=EC=B2=98=EB=A6=AC=20(#33)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/mypage/service/MypageService.java | 5 +++++ .../lux/once/global/common/ResponseCode.java | 17 ++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/ewha/lux/once/domain/mypage/service/MypageService.java b/src/main/java/ewha/lux/once/domain/mypage/service/MypageService.java index ca46537..e77b539 100644 --- a/src/main/java/ewha/lux/once/domain/mypage/service/MypageService.java +++ b/src/main/java/ewha/lux/once/domain/mypage/service/MypageService.java @@ -67,6 +67,11 @@ public ChatHistoryResponseDto.ChatHistoryDto getChatHistory(Users nowUser, Strin List chatList = chatHistoryRepository.findByUsersAndCreatedAtBetween(nowUser, startDate, endDate); + // 채팅이 없는 경우 + if (chatList.isEmpty()) { + throw new CustomException(ResponseCode.CHAT_HISTORY_NOT_FOUND); + } + List chatListDto = chatList.stream() .map(chatHistory -> { LocalDateTime createdAt = chatHistory.getCreatedAt(); diff --git a/src/main/java/ewha/lux/once/global/common/ResponseCode.java b/src/main/java/ewha/lux/once/global/common/ResponseCode.java index 8ea2ce2..385b609 100644 --- a/src/main/java/ewha/lux/once/global/common/ResponseCode.java +++ b/src/main/java/ewha/lux/once/global/common/ResponseCode.java @@ -25,15 +25,18 @@ public enum ResponseCode { INVALID_USER_ID(3001, false, "아이디가 존재하지 않습니다."), FAILED_TO_LOGIN(3002, false, "비밀번호가 일치하지 않습니다."), DUPLICATED_USER_NAME(3003, false,"이미 존재하는 아이디입니다."), - // 3100~ : + + // 3100~ : card 관련 오류 CARD_NOT_FOUND(3100, false,"존재하지 않는 카드입니다."), CARD_COMPANY_NOT_FOUND(3101, false,"존재하지 않는 카드사입니다."), - CHAT_HISTORY_NOT_FOUND(3102, false,"존재하지 않는 채팅입니다."), - ANNOUNCEMENT_NOT_FOUND(3103, false,"존재하지 않는 알림입니다."), - NO_SEARCH_RESULTS(3104, false, "검색 결과가 없습니다"), - OWNED_CARD_NOT_FOUND(3105, false, "보유한 카드가 없습니다."), - INVALID_OWNED_CARD(3106, false, "보유한 카드가 아닙니다."), - // 3200~ : + ANNOUNCEMENT_NOT_FOUND(3102, false,"존재하지 않는 알림입니다."), + NO_SEARCH_RESULTS(3103, false, "검색 결과가 없습니다"), + OWNED_CARD_NOT_FOUND(3104, false, "보유한 카드가 없습니다."), + INVALID_OWNED_CARD(3105, false, "보유한 카드가 아닙니다."), + + // 3200~ : mypage 관련 오류 + CHAT_HISTORY_NOT_FOUND(3200, false, "채팅이 존재하지 않습니다."), + // =====================================