feat: implement advanced tagging system, tag weighting, and app focus refactoring

- Implemented reusable TagSelector component with i18n support
- Added tag weighting system (popularity scores 1-5)
- Created admin panel for tag management
- Integrated Nebius AI and Brave Search for 'Magic Scan'
- Refactored app focus: removed bottle status, updated counters, and displayed extended bottle details
- Updated i18n for German and English
- Added database migration scripts
This commit is contained in:
2025-12-19 12:58:44 +01:00
parent 9eb9b41061
commit b2a1d292da
30 changed files with 2420 additions and 194 deletions

29
global_products.sql Normal file
View File

@@ -0,0 +1,29 @@
-- Global Products for caching searches
CREATE TABLE IF NOT EXISTS global_products (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
wb_id TEXT UNIQUE NOT NULL,
full_name TEXT NOT NULL,
search_vector tsvector GENERATED ALWAYS AS (to_tsvector('simple', full_name)) STORED,
image_hash TEXT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc'::text, now())
);
-- Index for search vector
CREATE INDEX IF NOT EXISTS idx_global_products_search_vector ON global_products USING GIN (search_vector);
-- Enable RLS
ALTER TABLE global_products ENABLE ROW LEVEL SECURITY;
-- Policies for global_products
-- Enable Read Access for all users (SELECT)
DROP POLICY IF EXISTS "Enable Read Access for all users" ON global_products;
CREATE POLICY "Enable Read Access for all users"
ON global_products FOR SELECT
USING (true);
-- Disable Insert/Update for normal users (only Service Role/Admins)
DROP POLICY IF EXISTS "Enable Admin Insert/Update" ON global_products;
CREATE POLICY "Enable Admin Insert/Update"
ON global_products FOR ALL
USING (EXISTS (SELECT 1 FROM admin_users WHERE user_id = (SELECT auth.uid())))
WITH CHECK (EXISTS (SELECT 1 FROM admin_users WHERE user_id = (SELECT auth.uid())));