Skip to content

Commit

Permalink
fix: 일지 조회 응답필드 변경 등록일시 추가
Browse files Browse the repository at this point in the history
Beakjiyeon committed Apr 6, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
mjcarroll Michael Carroll
1 parent 21129b3 commit 5dc8377
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

import com.unit.daybook.domain.board.entity.Board;

import java.time.LocalDateTime;
import java.util.List;

public record AddBoardResponseDto(
@@ -13,12 +14,12 @@ public record AddBoardResponseDto(
String category,
Long hearts,
List<String> hashtags,
String paperType

String paperType,
LocalDateTime createdAt
) {

public static AddBoardResponseDto from(Board board) {
List<String> hashContents = board.getHashtags().stream().map(hashtag -> hashtag.getContent()).toList();
return new AddBoardResponseDto(board.getBoardId(), board.getContent(), board.getRespectBoardId(), board.getMemeber().getId(), board.getCategory(), board.getHearts(), hashContents, board.getPaperType());
return new AddBoardResponseDto(board.getBoardId(), board.getContent(), board.getRespectBoardId(), board.getMemeber().getId(), board.getCategory(), board.getHearts(), hashContents, board.getPaperType(), board.getCreatedAt());
}
}
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
import lombok.Builder;
import lombok.Getter;

import java.time.LocalDateTime;
import java.util.List;

@Getter
@@ -15,6 +16,7 @@ public class BoardTmpResponse {
private Long hearts;
private String papaerType;
private List<String> hashtags;
private LocalDateTime createdAt;

@Builder
public BoardTmpResponse(AddBoardResponseDto dto, List<String> hashtags) {
@@ -26,5 +28,6 @@ public BoardTmpResponse(AddBoardResponseDto dto, List<String> hashtags) {
this.hearts = dto.hearts();
this.papaerType = dto.paperType();
this.hashtags = hashtags;
this.createdAt = dto.createdAt();
}
}

0 comments on commit 5dc8377

Please sign in to comment.