diff --git a/internal/handlers/collections.go b/internal/handlers/collections.go index 3edd69c..c566cd1 100644 --- a/internal/handlers/collections.go +++ b/internal/handlers/collections.go @@ -827,6 +827,11 @@ func (h *CollectionHandler) HandleBulkAddBooks(c echo.Context) error { } func (h *CollectionHandler) PreviewCollection(c echo.Context) error { + user := c.Get("user") + if user == nil { + return c.JSON(http.StatusUnauthorized, map[string]string{"error": "unauthorized"}) + } + var req struct { LibraryID string `json:"library_id"` Rules []services.Rule `json:"rules"`