diff --git a/database/schema/schema.sql b/database/schema/schema.sql index ef7e85f..d4b0cd6 100644 --- a/database/schema/schema.sql +++ b/database/schema/schema.sql @@ -68,10 +68,8 @@ CREATE TABLE user_ebook_folders ( user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, folder_path VARCHAR(500) NOT NULL, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), - UNIQUE(user_id, folder_path), - CONSTRAINT admin_only_folder CHECK (EXISTS ( - SELECT 1 FROM users WHERE id = user_id AND role = 'admin' - )) + UNIQUE(user_id, folder_path) + -- Note: Admin-only access is enforced at application level in handlers/auth.go ); -- Create indexes for better query performance @@ -94,4 +92,5 @@ COMMENT ON COLUMN ebook_ratings.rating IS 'Rating scale 1-10 (odd numbers = half -- - Admin users can: add/edit/delete folders, scan ebooks, modify ebook metadata, delete ebooks -- - Regular users can: view all ebooks, rate ebooks, track reading progress, manage their profile -- - To create first admin: UPDATE users SET role = 'admin' WHERE email = 'your-admin-email'; --- - Only admins can manage folders and ebook metadata \ No newline at end of file +-- - Only admins can manage folders and ebook metadata (enforced at application level) +-- - user_ebook_folders table admin-only access is enforced by AdminMiddleware in handlers \ No newline at end of file