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.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user