Skip to content

Commit 6ed277f

Browse files
committed
[BOOK-162] feat: infra - userbook에서 id와 userId로 도서 등록 여부 검증 메서드 구현 (#52)
1 parent f84a530 commit 6ed277f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

infra/src/main/kotlin/org/yapp/infra/userbook/repository/JpaUserBookRepository.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import java.util.*
66

77
interface JpaUserBookRepository : JpaRepository<UserBookEntity, UUID>, JpaUserBookQuerydslRepository {
88
fun findByUserIdAndBookIsbn(userId: UUID, bookIsbn: String): UserBookEntity?
9+
fun findByIdAndUserId(id: UUID, userId: UUID): UserBookEntity?
910
fun findAllByUserId(userId: UUID): List<UserBookEntity>
1011
fun findAllByUserIdAndBookIsbnIn(userId: UUID, bookIsbnList: List<String>): List<UserBookEntity>
1112

infra/src/main/kotlin/org/yapp/infra/userbook/repository/impl/UserBookRepositoryImpl.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ class UserBookRepositoryImpl(
1717

1818
override fun findByUserIdAndBookIsbn(userId: UUID, isbn: String): UserBook? {
1919
return jpaUserBookRepository.findByUserIdAndBookIsbn(userId, isbn)?.toDomain()
20+
}
2021

22+
override fun findByIdAndUserId(id: UUID, userId: UUID): UserBook? {
23+
return jpaUserBookRepository.findByIdAndUserId(id, userId)?.toDomain()
2124
}
2225

2326
override fun save(userBook: UserBook): UserBook {

0 commit comments

Comments
 (0)