Skip to content

Commit

Permalink
refactor: ChattingMessageHistory -> ChattingHistory
Browse files Browse the repository at this point in the history
  • Loading branch information
yumyeonghan committed Dec 19, 2023
1 parent 6485732 commit f3d595e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static lombok.AccessLevel.PRIVATE;

import coffeemeet.server.chatting.history.service.dto.ChattingMessageHistory;
import coffeemeet.server.chatting.history.service.dto.ChattingHistory;
import coffeemeet.server.chatting.history.service.dto.ChattingMessageHistoryListDto;
import java.util.List;
import lombok.NoArgsConstructor;
Expand All @@ -11,7 +11,7 @@
public final class ChattingMessageHistoriesHTTP {

public record Response(
List<ChattingMessageHistory> chatHistories,
List<ChattingHistory> chatHistories,
boolean hasNext) {

public static Response from(ChattingMessageHistoryListDto chattingMessageHistoryListDto) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package coffeemeet.server.chatting.history.service;

import coffeemeet.server.chatting.history.domain.ChattingMessageHistory;
import coffeemeet.server.chatting.history.domain.ChattingRoomHistory;
import coffeemeet.server.chatting.history.domain.UserChattingHistory;
import coffeemeet.server.chatting.history.implement.ChattingMessageHistoryQuery;
import coffeemeet.server.chatting.history.implement.ChattingRoomHistoryQuery;
import coffeemeet.server.chatting.history.implement.UserChattingHistoryQuery;
import coffeemeet.server.chatting.history.service.dto.ChattingMessageHistory;
import coffeemeet.server.chatting.history.service.dto.ChattingHistory;
import coffeemeet.server.chatting.history.service.dto.ChattingMessageHistoryListDto;
import coffeemeet.server.chatting.history.service.dto.ChattingRoomHistoryDto;
import coffeemeet.server.user.domain.User;
Expand Down Expand Up @@ -48,13 +49,13 @@ public ChattingMessageHistoryListDto searchChattingMessageHistories(Long roomHis
Long firstMessageId, int pageSize) {
ChattingRoomHistory chattingRoomHistory = chattingRoomHistoryQuery.getChattingRoomHistoryBy(
roomHistoryId);
List<coffeemeet.server.chatting.history.domain.ChattingMessageHistory> messageHistories = chattingMessageHistoryQuery.getMessageHistories(
List<ChattingMessageHistory> messageHistories = chattingMessageHistoryQuery.getMessageHistories(
chattingRoomHistory, firstMessageId,
pageSize);
boolean hasNext = messageHistories.size() >= pageSize;
List<ChattingMessageHistory> historyDtoList = messageHistories
List<ChattingHistory> historyDtoList = messageHistories
.stream()
.map(chattingMessageHistory -> ChattingMessageHistory.of(
.map(chattingMessageHistory -> ChattingHistory.of(
chattingMessageHistory.getUser(), chattingMessageHistory))
.toList();
return ChattingMessageHistoryListDto.of(historyDtoList, hasNext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;

public record ChattingMessageHistory(
public record ChattingHistory(
Long userId,
Long messageId,
String nickname,
Expand All @@ -14,9 +14,9 @@ public record ChattingMessageHistory(
LocalDateTime createdAt
) {

public static ChattingMessageHistory of(User user,
public static ChattingHistory of(User user,
coffeemeet.server.chatting.history.domain.ChattingMessageHistory chattingMessageHistory) {
return new ChattingMessageHistory(
return new ChattingHistory(
user.getId(),
chattingMessageHistory.getId(),
user.getProfile().getNickname(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import java.util.List;

public record ChattingMessageHistoryListDto(
List<ChattingMessageHistory> contents,
List<ChattingHistory> contents,
boolean hasNext
) {

public static ChattingMessageHistoryListDto of(List<ChattingMessageHistory> contents,
public static ChattingMessageHistoryListDto of(List<ChattingHistory> contents,
boolean hasNext) {
return new ChattingMessageHistoryListDto(contents, hasNext);
}
Expand Down

0 comments on commit f3d595e

Please sign in to comment.