Add position for book in collection

This commit is contained in:
2026-04-11 17:26:21 +02:00
parent 36a21c8891
commit d2fe3bf34f
14 changed files with 200 additions and 58 deletions

View File

@@ -5,6 +5,7 @@ import (
"net/http"
"strconv"
"git.artlef.fr/bibliomane/internal/adapter"
"git.artlef.fr/bibliomane/internal/appcontext"
"git.artlef.fr/bibliomane/internal/dto"
"git.artlef.fr/bibliomane/internal/i18nresource"
@@ -50,12 +51,13 @@ func GetCollectionHandler(ac appcontext.AppContext) {
myvalidator.ReturnErrorsAsJsonResponse(&ac, err)
return
}
books, err := query.FetchCollectionBooks(ac.Db, user.ID, uint(collectionId), limit, offset)
itemsQueryResult, err := query.FetchCollectionItems(ac.Db, user.ID, uint(collectionId), limit, offset)
if err != nil {
myvalidator.ReturnErrorsAsJsonResponse(&ac, err)
return
}
collection.Books = books
items := adapter.CollectionItemsQueryToDto(itemsQueryResult)
collection.Items = items
count, err := query.FetchCollectionBooksCount(ac.Db, user.ID, uint(collectionId))
if err != nil {
myvalidator.ReturnErrorsAsJsonResponse(&ac, err)