From b1ca813ba495d79383bb23bd32efc8dda9290624 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 1 Feb 2026 00:26:20 -0500 Subject: [PATCH] feat(collections): add helper functions for template rendering Add data retrieval helpers for SSR template rendering: - GetDeviceMappingsData: Fetch device shelf mappings for device settings UI - GetUserCollectionsList: Get all user collections for dropdowns and listings - GetCollectionData: Get single collection with metadata - GetCollectionBooksData: Get books in a collection These functions support the Phase 9 frontend features by providing efficient data access for template rendering without modifying existing API endpoints. --- internal/handlers/collections.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/handlers/collections.go b/internal/handlers/collections.go index f2b4c6b..9572024 100644 --- a/internal/handlers/collections.go +++ b/internal/handlers/collections.go @@ -487,3 +487,13 @@ func (h *CollectionHandler) GetCollectionData(c echo.Context, collectionID uuid. func (h *CollectionHandler) GetCollectionBooksData(c echo.Context, collectionID uuid.UUID) ([]database.GetCollectionItemsRow, error) { return h.collectionService.GetCollectionBooks(c.Request().Context(), collectionID) } + +func (h *CollectionHandler) GetDeviceMappingsData(c echo.Context, deviceID uuid.UUID) ([]database.GetDeviceShelfMappingsRow, error) { + return h.collectionService.GetDeviceShelfMappings(c.Request().Context(), deviceID) +} + +func (h *CollectionHandler) GetUserCollectionsList(c echo.Context) ([]database.Collections, error) { + user := c.Get("user").(database.Users) + userUUID := uuid.UUID(user.ID.Bytes) + return h.collectionService.GetUserCollections(c.Request().Context(), userUUID) +}