forked from kookmin-sw/cap-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
103 additions
and
5 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
6 changes: 6 additions & 0 deletions
6
backend/src/main/java/com/project/capstone/member/controller/dto/AddMyBookRequest.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,6 @@ | ||
package com.project.capstone.member.controller.dto; | ||
|
||
public record AddMyBookRequest( | ||
|
||
) { | ||
} |
14 changes: 14 additions & 0 deletions
14
backend/src/main/java/com/project/capstone/member/controller/dto/MyBookResponse.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,14 @@ | ||
package com.project.capstone.member.controller.dto; | ||
|
||
import com.project.capstone.mybook.domain.MyBook; | ||
|
||
public record MyBookResponse( | ||
Long id, | ||
String title, | ||
String author, | ||
String publisher | ||
) { | ||
public MyBookResponse(MyBook myBook) { | ||
this(myBook.getId(), myBook.getBook().getTitle(), myBook.getBook().getAuthor(), myBook.getBook().getPublisher()); | ||
} | ||
} |
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
backend/src/main/java/com/project/capstone/mybook/domain/MyBook.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.project.capstone.mybook.domain; | ||
|
||
import com.fasterxml.jackson.annotation.JsonBackReference; | ||
import com.project.capstone.book.domain.Book; | ||
import com.project.capstone.member.domain.Member; | ||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
public class MyBook { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@JsonBackReference | ||
@ManyToOne | ||
private Member member; | ||
|
||
@JsonBackReference | ||
@ManyToOne | ||
private Book book; | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
backend/src/main/java/com/project/capstone/mybook/domain/MyBookRepository.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,11 @@ | ||
package com.project.capstone.mybook.domain; | ||
|
||
import com.project.capstone.member.domain.Member; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
public interface MyBookRepository extends JpaRepository<MyBook, Long> { | ||
List<MyBook> findMyBooksByMember(Member member); | ||
} |