refactor(cards): smart-collection preview through the builder
POST preview-feed had the ladder's 14th hand-rolled literal. Now BookCardsFromMediaItems + one LibraryTypeMap per request; the response carries format_group/badge values for the first time (all seven keys were already emitted as zero-value JSON, so this is a value change on a pin-frozen shape, not a key change).
This commit is contained in:
1 parent
23765934ef
commit
c07dba4eff
1 file changed
+1
-10
@@ -1251,16 +1251,7 @@ func (h *CollectionHandler) PreviewCollection(c *echo.Context) error {
|
|||||||
matchedItems = matchedItems[:req.Limit]
|
matchedItems = matchedItems[:req.Limit]
|
||||||
}
|
}
|
||||||
|
|
||||||
bookCards := make([]BookInfo, len(matchedItems))
|
bookCards := BookCardsFromMediaItems(matchedItems, LibraryTypeMap(c.Request().Context(), h.db))
|
||||||
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),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return c.JSON(http.StatusOK, map[string]interface{}{"items": bookCards})
|
return c.JSON(http.StatusOK, map[string]interface{}{"items": bookCards})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user