Skip to content

Commit

Permalink
포토북 목록
Browse files Browse the repository at this point in the history
  • Loading branch information
HyungJu committed Sep 24, 2024
1 parent c85446f commit 4d2c2fa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ class PhotoBookService(
memberId: Long,
): PhotoBook? {
val photoBooks = photoBookRepository.getAllPhotobookWithoutPhototicket(memberId)
return photoBooks.randomOrNull()
return photoBooks.firstOrNull()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ interface JpaPhotoRepository : JpaRepository<PhotoEntity, String> {
fun findAllByPhotobookId(photobookId: Long): List<PhotoEntity>

fun findFirstByPhotobookId(photobookId: Long): PhotoEntity?
fun findFirstByPhotobookIdIn(photobookIds: List<Long>): List<PhotoEntity>
fun findAllByPhotobookIdIn(photobookIds: List<Long>): List<PhotoEntity>
fun findAllByPhotobookIdAndIsPhototicket(photobookId: Long, isPhototicket: Boolean): List<PhotoEntity>
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class PhotoBookRepositoryImpl(
override fun getAllByMemberId(memberId: Long): List<PhotoBook> {
val entities = jpaPhotoBookRepository.findAllByMemberId(memberId)

val photos = jpaPhotoRepository.findFirstByPhotobookIdIn(entities.map { it.id })
val photos = jpaPhotoRepository.findAllByPhotobookIdIn(entities.map { it.id })
.groupBy { it.photobookId }
.mapValues { it.value.map { photo -> photo.toDomain() } }

Expand Down

0 comments on commit 4d2c2fa

Please sign in to comment.