-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/#12
- Loading branch information
Showing
9 changed files
with
154 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/com/unit/daybook/domain/board/dto/request/AddBoardRequestDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package com.unit.daybook.domain.board.dto.request; | ||
|
||
|
||
public record AddBoardRequestDto(String content, Long respectBoardId) { | ||
public record AddBoardRequestDto(String content, Long respectBoardId, String category, Long hearts) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/com/unit/daybook/domain/board/entity/ReadBoard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.unit.daybook.domain.board.entity; | ||
|
||
import com.unit.daybook.domain.common.model.BaseTimeEntity; | ||
import com.unit.daybook.domain.member.domain.Member; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Entity | ||
@Table(name = "read_board") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
class ReadBoard extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "read_board_id") | ||
private Long readBoardId; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "member_id") | ||
private Member member; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "board_id") | ||
private Board board; | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/unit/daybook/domain/board/repository/BoardRepositoryCustom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.unit.daybook.domain.board.repository; | ||
|
||
|
||
public interface BoardRepositoryCustom { | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/com/unit/daybook/domain/board/repository/BoardRepositoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.unit.daybook.domain.board.repository; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import com.unit.daybook.domain.board.entity.Board; | ||
import com.unit.daybook.domain.board.entity.QBoard; | ||
import com.unit.daybook.domain.member.domain.QMember; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
import static com.unit.daybook.domain.board.entity.QBoard.board; | ||
import static com.unit.daybook.domain.member.domain.QMember.member; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class BoardRepositoryImpl implements BoardRepositoryCustom { | ||
private final JPAQueryFactory queryFactory; | ||
|
||
public List<Board> findBoardsByMemberId(Long memberId) { | ||
|
||
List<Board> boards = queryFactory | ||
.select(board) | ||
.from(board) | ||
.join(board.memeber, member).fetchJoin() | ||
.where( | ||
member.id.eq(memberId) | ||
) | ||
.fetch(); | ||
|
||
return boards; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters