Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 일지 용지타입 필드 추가 #26

Merged
merged 1 commit into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

import java.util.List;

public record AddBoardRequestDto(String content, Long respectBoardId, String category, Long hearts, List<String> hashtags) {
public record AddBoardRequestDto(String content, Long respectBoardId, String category, Long hearts, List<String> hashtags, String paperType) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ public record AddBoardResponseDto(
String content,
Long respectBoardId,
Long authorId,

String category,
Long hearts,
List<String> hashtags
List<String> hashtags,
String paperType

) {

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);
return new AddBoardResponseDto(board.getBoardId(), board.getContent(), board.getRespectBoardId(), board.getMemeber().getId(), board.getCategory(), board.getHearts(), hashContents, board.getPaperType());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class BoardTmpResponse {
private Long authorId;
private String category;
private Long hearts;
private String papaerType;
private List<String> hashtags;

@Builder
Expand All @@ -23,6 +24,7 @@ public BoardTmpResponse(AddBoardResponseDto dto, List<String> hashtags) {
this.authorId = dto.authorId();
this.category = dto.category();
this.hearts = dto.hearts();
this.papaerType = dto.paperType();
this.hashtags = hashtags;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,32 @@ public class Board extends BaseTimeEntity {
@JoinColumn(name = "member_id")
private Member memeber;

@Column
private String paperType;

@Column
private Long hearts;

@OneToMany(mappedBy = "board")
private List<Hashtag> hashtags = new ArrayList<>();

@Builder(access = AccessLevel.PRIVATE)
public Board(Long boardId, String content, Long respectBoardId, Member member, String category, Long hearts) {
public Board(Long boardId, String content, Long respectBoardId, Member member, String category, Long hearts, String paperType) {
this.boardId = boardId;
this.content = content;
this.respectBoardId = respectBoardId;
this.memeber = member;
this.category = category;
this.hearts = hearts;
this.paperType = paperType;
}

public static Board createBoard(AddBoardRequestDto addBoardRequestDto, Member member) {
return Board.builder()
.content(addBoardRequestDto.content())
.respectBoardId(addBoardRequestDto.respectBoardId())
.member(member)
.paperType(addBoardRequestDto.paperType())
.category(addBoardRequestDto.category())
.hearts(0L)
.build();
Expand Down
Loading