From 401e2358996feff308e680c6b684ae96bf5e05f6 Mon Sep 17 00:00:00 2001 From: Jiyun Date: Tue, 18 Feb 2025 08:21:05 +0800 Subject: [PATCH 1/6] =?UTF-8?q?#120=20Fix:=20Notification=20Response?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=BD=94=EC=9D=B8=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=EB=94=94=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/notification/converter/NotificationConverter.java | 1 + .../domain/notification/dto/response/NotificationResponse.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/main/java/com/memesphere/domain/notification/converter/NotificationConverter.java b/src/main/java/com/memesphere/domain/notification/converter/NotificationConverter.java index b6682fa7..9dbcee92 100644 --- a/src/main/java/com/memesphere/domain/notification/converter/NotificationConverter.java +++ b/src/main/java/com/memesphere/domain/notification/converter/NotificationConverter.java @@ -29,6 +29,7 @@ public static NotificationResponse toNotificationCreateResponse(Notification not .volatility(notification.getVolatility()) .stTime(notification.getStTime()) .isRising(notification.getIsRising()) + .coinId(memeCoin.getId()) .build(); } diff --git a/src/main/java/com/memesphere/domain/notification/dto/response/NotificationResponse.java b/src/main/java/com/memesphere/domain/notification/dto/response/NotificationResponse.java index 10f59e61..3abe288d 100644 --- a/src/main/java/com/memesphere/domain/notification/dto/response/NotificationResponse.java +++ b/src/main/java/com/memesphere/domain/notification/dto/response/NotificationResponse.java @@ -28,4 +28,7 @@ public class NotificationResponse { @Schema(description = "알림 켜기/끄기", example = "True") private Boolean isOn; + + @Schema(description = "코인 아이디", example = "1") + private Long coinId; } From be255eeb3738d0b78c33f6cdaf23d6b158412598 Mon Sep 17 00:00:00 2001 From: Jiyun Date: Tue, 18 Feb 2025 08:27:40 +0800 Subject: [PATCH 2/6] =?UTF-8?q?#120=20Fix:=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EC=82=AC=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/notification/converter/NotificationConverter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/memesphere/domain/notification/converter/NotificationConverter.java b/src/main/java/com/memesphere/domain/notification/converter/NotificationConverter.java index 9dbcee92..72cbf33f 100644 --- a/src/main/java/com/memesphere/domain/notification/converter/NotificationConverter.java +++ b/src/main/java/com/memesphere/domain/notification/converter/NotificationConverter.java @@ -18,6 +18,7 @@ public static Notification toNotification(NotificationRequest notificationReques .stTime(notificationRequest.getStTime()) .isRising(notificationRequest.getIsRising()) .user(user) + .isOn(true) .build(); } @@ -29,6 +30,7 @@ public static NotificationResponse toNotificationCreateResponse(Notification not .volatility(notification.getVolatility()) .stTime(notification.getStTime()) .isRising(notification.getIsRising()) + .isOn(notification.getIsOn()) .coinId(memeCoin.getId()) .build(); } From a05dbe827a44a52bee2ebe7ba8b110bff34eb01f Mon Sep 17 00:00:00 2001 From: Jiyun Date: Tue, 18 Feb 2025 18:38:56 +0800 Subject: [PATCH 3/6] =?UTF-8?q?#124=20Fix:=20=EC=B1=84=ED=8C=85=20?= =?UTF-8?q?=EC=A2=8B=EC=95=84=EC=9A=94=20=EC=97=AC=EB=B6=80=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/chat/controller/ChatController.java | 15 +++++++++------ .../domain/chat/converter/ChatConverter.java | 5 ++++- .../domain/chat/dto/response/ChatResponse.java | 3 +++ .../domain/chat/service/ChatService.java | 11 ++++++----- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/memesphere/domain/chat/controller/ChatController.java b/src/main/java/com/memesphere/domain/chat/controller/ChatController.java index e315d4e2..9d8eceae 100644 --- a/src/main/java/com/memesphere/domain/chat/controller/ChatController.java +++ b/src/main/java/com/memesphere/domain/chat/controller/ChatController.java @@ -3,6 +3,7 @@ import com.memesphere.domain.chat.dto.request.ChatRequest; import com.memesphere.domain.chat.dto.response.ChatResponse; import com.memesphere.domain.chat.service.ChatService; +import com.memesphere.domain.user.entity.User; import com.memesphere.global.apipayload.ApiResponse; import com.memesphere.global.jwt.CustomUserDetails; import io.swagger.v3.oas.annotations.Operation; @@ -36,20 +37,22 @@ public ChatResponse chat(@DestinationVariable("coin_id") Long coin_id, @Operation(summary = "코인별 채팅 전체 메시지 조회 API", description = "특정 코인의 채팅방의 전체 메시지를 보여줍니다.") public ApiResponse> getChatList(@PathVariable("coin_id") Long coin_id, - Pageable pageable) { + Pageable pageable, + @AuthenticationPrincipal CustomUserDetails customUserDetails) { + User user = customUserDetails.getUser(); - return ApiResponse.onSuccess(chatService.getChatList(coin_id, pageable)); + return ApiResponse.onSuccess(chatService.getChatList(coin_id, pageable, user)); } //최신 댓글 조회 Api @GetMapping("/chat/{coin_id}/latest") @Operation(summary = "코인별 최신 댓글 조회 API", description = "특정 코인에 대한 최신 댓글을 반환합니다. 요청 시 최신 댓글 하나만 가져옵니다.") - public ApiResponse getLatestMessages( - @PathVariable("coin_id") Long coin_id) { - + public ApiResponse getLatestMessages(@PathVariable("coin_id") Long coin_id, + @AuthenticationPrincipal CustomUserDetails customUserDetails) { + User user = customUserDetails.getUser(); // 최신 댓글을 가져오는 서비스 메서드 호출 - ChatResponse latestMessage = chatService.getLatestMessages(coin_id); + ChatResponse latestMessage = chatService.getLatestMessages(coin_id, user); return ApiResponse.onSuccess(latestMessage); } diff --git a/src/main/java/com/memesphere/domain/chat/converter/ChatConverter.java b/src/main/java/com/memesphere/domain/chat/converter/ChatConverter.java index 6ab763aa..c63ee3ca 100644 --- a/src/main/java/com/memesphere/domain/chat/converter/ChatConverter.java +++ b/src/main/java/com/memesphere/domain/chat/converter/ChatConverter.java @@ -7,6 +7,8 @@ import com.memesphere.domain.chat.dto.response.ChatResponse; import com.memesphere.domain.user.entity.User; +import java.util.stream.Collectors; + public class ChatConverter { public static Chat toChat(MemeCoin memeCoin, ChatRequest chatRequest, User user) { @@ -18,7 +20,7 @@ public static Chat toChat(MemeCoin memeCoin, ChatRequest chatRequest, User user) .build(); } - public static ChatResponse toChatResponse(Chat chat) { + public static ChatResponse toChatResponse(Chat chat, User user) { return ChatResponse.builder() .id(chat.getId()) @@ -27,6 +29,7 @@ public static ChatResponse toChatResponse(Chat chat) { .likes(chat.getChatLikeList().size()) .createdAt(chat.getCreatedAt()) .nickname(chat.getUser().getNickname()) + .isLiked(chat.getChatLikeList().contains(user)) .build(); } diff --git a/src/main/java/com/memesphere/domain/chat/dto/response/ChatResponse.java b/src/main/java/com/memesphere/domain/chat/dto/response/ChatResponse.java index 336c3fb8..6374cebb 100644 --- a/src/main/java/com/memesphere/domain/chat/dto/response/ChatResponse.java +++ b/src/main/java/com/memesphere/domain/chat/dto/response/ChatResponse.java @@ -25,6 +25,9 @@ public class ChatResponse { @Schema(description = "좋아요 수", example = "17") private int likes; + @Schema(description = "좋아요 여부", example = "True") + private boolean isLiked; + @Schema(description = "전송 시간", example = "2025-01-01T00:00:00") private LocalDateTime createdAt; } diff --git a/src/main/java/com/memesphere/domain/chat/service/ChatService.java b/src/main/java/com/memesphere/domain/chat/service/ChatService.java index e2d93afd..c09ba1a7 100644 --- a/src/main/java/com/memesphere/domain/chat/service/ChatService.java +++ b/src/main/java/com/memesphere/domain/chat/service/ChatService.java @@ -41,19 +41,20 @@ public ChatResponse saveMessage(Long coin_id, ChatRequest chatRequest) { Chat chat = ChatConverter.toChat(memeCoin, chatRequest, user); Chat savedChat = chatRepository.save(chat); - return ChatConverter.toChatResponse(savedChat); + return ChatConverter.toChatResponse(savedChat, user); } @Transactional - public Page getChatList(Long coin_id, Pageable pageable) { + public Page getChatList(Long coin_id, Pageable pageable, User user) { Page chatPage = chatRepository.findAllByMemeCoin_Id(coin_id, pageable); - return chatPage.map(ChatConverter::toChatResponse); + + return chatPage.map(chat -> ChatConverter.toChatResponse(chat, user)); } // 최신 댓글을 가져오는 메서드 @Transactional - public ChatResponse getLatestMessages(Long coin_id) { + public ChatResponse getLatestMessages(Long coin_id, User user) { MemeCoin memeCoin = memeCoinRepository.findById(coin_id) //id에 해당하는 밈코인 없을 때 @@ -68,7 +69,7 @@ public ChatResponse getLatestMessages(Long coin_id) { } // 최신 댓글을 ChatResponse로 변환하여 반환 - return ChatConverter.toChatResponse(latestChat); + return ChatConverter.toChatResponse(latestChat, user); } @Transactional From f8965d6a607d7ee515e97f5e88212d614eda6b00 Mon Sep 17 00:00:00 2001 From: Jiyun Date: Wed, 19 Feb 2025 01:46:50 +0800 Subject: [PATCH 4/6] =?UTF-8?q?#127=20Fix:=20=EC=B1=84=ED=8C=85=20?= =?UTF-8?q?=EC=A2=8B=EC=95=84=EC=9A=94=20=EC=97=AC=EB=B6=80=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/memesphere/domain/chat/converter/ChatConverter.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/memesphere/domain/chat/converter/ChatConverter.java b/src/main/java/com/memesphere/domain/chat/converter/ChatConverter.java index c63ee3ca..dbc8ef97 100644 --- a/src/main/java/com/memesphere/domain/chat/converter/ChatConverter.java +++ b/src/main/java/com/memesphere/domain/chat/converter/ChatConverter.java @@ -7,6 +7,7 @@ import com.memesphere.domain.chat.dto.response.ChatResponse; import com.memesphere.domain.user.entity.User; +import java.util.Objects; import java.util.stream.Collectors; public class ChatConverter { @@ -21,7 +22,10 @@ public static Chat toChat(MemeCoin memeCoin, ChatRequest chatRequest, User user) } public static ChatResponse toChatResponse(Chat chat, User user) { + boolean isLiked = chat.getChatLikeList().stream() + .anyMatch(chatLike -> Objects.equals(chatLike.getUser().getId(), user.getId())); + if (chat.getChatLikeList().isEmpty()) {} return ChatResponse.builder() .id(chat.getId()) .message(chat.getMessage()) @@ -29,7 +33,7 @@ public static ChatResponse toChatResponse(Chat chat, User user) { .likes(chat.getChatLikeList().size()) .createdAt(chat.getCreatedAt()) .nickname(chat.getUser().getNickname()) - .isLiked(chat.getChatLikeList().contains(user)) + .isLiked(isLiked) .build(); } From 571ee2ce423cab09cee995090e5138b5e174080d Mon Sep 17 00:00:00 2001 From: Jiyun Date: Wed, 19 Feb 2025 08:23:30 +0800 Subject: [PATCH 5/6] =?UTF-8?q?#129=20Fix:=20=EC=B1=84=ED=8C=85=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EA=B0=80=EB=8A=A5=EB=B2=94=EC=9C=84=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/memesphere/domain/chat/controller/ChatController.java | 2 +- .../com/memesphere/domain/chat/converter/ChatConverter.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/memesphere/domain/chat/controller/ChatController.java b/src/main/java/com/memesphere/domain/chat/controller/ChatController.java index 9d8eceae..f30231f0 100644 --- a/src/main/java/com/memesphere/domain/chat/controller/ChatController.java +++ b/src/main/java/com/memesphere/domain/chat/controller/ChatController.java @@ -39,7 +39,7 @@ public ChatResponse chat(@DestinationVariable("coin_id") Long coin_id, public ApiResponse> getChatList(@PathVariable("coin_id") Long coin_id, Pageable pageable, @AuthenticationPrincipal CustomUserDetails customUserDetails) { - User user = customUserDetails.getUser(); + User user = (customUserDetails != null) ? customUserDetails.getUser() : null; return ApiResponse.onSuccess(chatService.getChatList(coin_id, pageable, user)); } diff --git a/src/main/java/com/memesphere/domain/chat/converter/ChatConverter.java b/src/main/java/com/memesphere/domain/chat/converter/ChatConverter.java index dbc8ef97..ba43db24 100644 --- a/src/main/java/com/memesphere/domain/chat/converter/ChatConverter.java +++ b/src/main/java/com/memesphere/domain/chat/converter/ChatConverter.java @@ -22,10 +22,9 @@ public static Chat toChat(MemeCoin memeCoin, ChatRequest chatRequest, User user) } public static ChatResponse toChatResponse(Chat chat, User user) { - boolean isLiked = chat.getChatLikeList().stream() + boolean isLiked = user != null && chat.getChatLikeList().stream() .anyMatch(chatLike -> Objects.equals(chatLike.getUser().getId(), user.getId())); - if (chat.getChatLikeList().isEmpty()) {} return ChatResponse.builder() .id(chat.getId()) .message(chat.getMessage()) From 1c5dcbaf121294fc1e9d0fcea77d71ddf41658fe Mon Sep 17 00:00:00 2001 From: SeoyeonPark1223 Date: Wed, 19 Feb 2025 16:55:23 +0900 Subject: [PATCH 6/6] =?UTF-8?q?#134=20Fix:=20GRID=EB=B7=B0=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=EB=8B=B9=2012=EA=B0=9C=20=EC=BD=94=EC=9D=B8?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/collection/service/CollectionQueryServiceImpl.java | 2 +- .../domain/dashboard/service/DashboardQueryServiceImpl.java | 2 +- .../domain/search/service/SearchQueryServiceImpl.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/memesphere/domain/collection/service/CollectionQueryServiceImpl.java b/src/main/java/com/memesphere/domain/collection/service/CollectionQueryServiceImpl.java index ad3ef60a..f9c89ebe 100644 --- a/src/main/java/com/memesphere/domain/collection/service/CollectionQueryServiceImpl.java +++ b/src/main/java/com/memesphere/domain/collection/service/CollectionQueryServiceImpl.java @@ -28,7 +28,7 @@ public class CollectionQueryServiceImpl implements CollectionQueryService { public Page getCollectionPage(Long userId, Integer pageNumber, ViewType viewType, SortType sortType) { int pageSize = switch (viewType) { - case GRID -> 9; + case GRID -> 12; case LIST -> 20; default -> throw new GeneralException(ErrorStatus.UNSUPPORTED_VIEW_TYPE); }; diff --git a/src/main/java/com/memesphere/domain/dashboard/service/DashboardQueryServiceImpl.java b/src/main/java/com/memesphere/domain/dashboard/service/DashboardQueryServiceImpl.java index cabed42c..13f9ee55 100644 --- a/src/main/java/com/memesphere/domain/dashboard/service/DashboardQueryServiceImpl.java +++ b/src/main/java/com/memesphere/domain/dashboard/service/DashboardQueryServiceImpl.java @@ -77,7 +77,7 @@ public SearchPageResponse getChartPage(Long userId, ViewType viewType, SortType Collections.emptyList() : collectionQueryService.getUserCollectionIds(userId); int pageSize = switch (viewType) { - case GRID -> 9; + case GRID -> 12; case LIST -> 20; default -> throw new GeneralException(ErrorStatus.UNSUPPORTED_VIEW_TYPE); }; diff --git a/src/main/java/com/memesphere/domain/search/service/SearchQueryServiceImpl.java b/src/main/java/com/memesphere/domain/search/service/SearchQueryServiceImpl.java index 28a46a5f..bd9267a2 100644 --- a/src/main/java/com/memesphere/domain/search/service/SearchQueryServiceImpl.java +++ b/src/main/java/com/memesphere/domain/search/service/SearchQueryServiceImpl.java @@ -26,7 +26,7 @@ public Page getSearchPage(String searchWord, ViewType viewType, SortTy // sortType --> MKT_CAP, VOLUME_24H, PRICE int pageSize = switch (viewType) { - case GRID -> 9; + case GRID -> 12; case LIST -> 20; default -> throw new GeneralException(ErrorStatus.UNSUPPORTED_VIEW_TYPE); };