Collection: new widget to add book to collection

This commit is contained in:
2026-04-04 23:15:44 +02:00
parent c7abbfe4d4
commit 2552ba8e94
11 changed files with 279 additions and 16 deletions

View File

@@ -38,7 +38,7 @@ func GetSearchBooksHandler(ac appcontext.AppContext) {
return
}
var returnedBooks dto.BookItemsGet
if !params.Inventaire {
if params.Inventaire != dto.ForceInventaireSearch {
books, err := query.FetchBookSearchGet(ac.Db, user.ID, searchterm, limit, offset)
if err != nil {
myvalidator.ReturnErrorsAsJsonResponse(&ac, err)
@@ -51,7 +51,7 @@ func GetSearchBooksHandler(ac appcontext.AppContext) {
}
returnedBooks = dto.BookItemsGet{Count: count, Inventaire: false, Books: books}
}
if params.Inventaire || len(returnedBooks.Books) == 0 {
if (params.Inventaire == dto.InventaireIfNothingFound && len(returnedBooks.Books) == 0) || (params.Inventaire == dto.ForceInventaireSearch) {
returnedBooksPtr, err := searchInInventaireAPI(ac.Config.InventaireUrl, searchterm, limit, offset, params)
if err != nil {
myvalidator.ReturnErrorsAsJsonResponse(&ac, err)