Skip to content

Commit

Permalink
fix: 404 on bulk edit bayang#143
Browse files Browse the repository at this point in the history
  • Loading branch information
bayang committed Sep 23, 2024
1 parent 92e7827 commit 99b0ce4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/kotlin/io/github/bayang/jelu/dao/BookRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import org.jetbrains.exposed.sql.Query
import org.jetbrains.exposed.sql.Random
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.SizedCollection
import org.jetbrains.exposed.sql.SizedIterable
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.sql.SqlExpressionBuilder.inList
Expand Down Expand Up @@ -1072,6 +1073,8 @@ class BookRepository(

fun findUserBookById(userbookId: UUID): UserBook = UserBook[userbookId]

fun findUserBookByIdInList(userbookIds: List<UUID>): SizedIterable<UserBook> = UserBook.forIds(userbookIds)

fun findUserBookByCriteria(
userID: UUID,
bookId: UUID?,
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/io/github/bayang/jelu/service/BookService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,9 @@ class BookService(
fun bulkEditUserbooks(userBookBulkUpdateDto: UserBookBulkUpdateDto): Int {
val res = bookRepository.bulkEditUserbooks(userBookBulkUpdateDto)
if (!userBookBulkUpdateDto.removeTags.isNullOrEmpty() || !userBookBulkUpdateDto.addTags.isNullOrEmpty()) {
searchIndexService.booksUpdated(userBookBulkUpdateDto.ids)
val bookIds =
bookRepository.findUserBookByIdInList(userBookBulkUpdateDto.ids).map { ub -> ub.book.id.value }.toList()
searchIndexService.booksUpdated(bookIds)
}
return res
}
Expand Down

0 comments on commit 99b0ce4

Please sign in to comment.