diff --git a/internal/handlers/collections.go b/internal/handlers/collections.go index 997b6317..e77d8260 100644 --- a/internal/handlers/collections.go +++ b/internal/handlers/collections.go @@ -1251,16 +1251,7 @@ func (h *CollectionHandler) PreviewCollection(c *echo.Context) error { matchedItems = matchedItems[:req.Limit] } - bookCards := make([]BookInfo, len(matchedItems)) - for i, item := range matchedItems { - itemUUID, _ := uuid.FromBytes(item.ID.Bytes[0:16]) - bookCards[i] = BookInfo{ - MediaItemID: itemUUID.String(), - Title: item.Title, - Author: textToString(item.Author), - CoverImagePath: utils.ResolveMediaURL(item.LibraryID, item.CoverImagePath), - } - } + bookCards := BookCardsFromMediaItems(matchedItems, LibraryTypeMap(c.Request().Context(), h.db)) return c.JSON(http.StatusOK, map[string]interface{}{"items": bookCards}) }