Skip to content

Commit

Permalink
Merge pull request #26 from T1F5/feature/#22
Browse files Browse the repository at this point in the history
feat: 일지 용지타입 필드 추가
  • Loading branch information
Beakjiyeon authored Apr 6, 2024
2 parents 51ec35b + 03c966c commit 5c1ab64
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
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

0 comments on commit 5c1ab64

Please sign in to comment.