feat: Add Spotify-style backdrop, Cascade OCR, Smart Scan Flow & OCR Dashboard
- BottleGrid: Implement blurred backdrop effect for bottle cards - Cascade OCR: TextDetector → RegEx → Fuzzy Match → window.ai pipeline - Smart Scan: Native OCR for Android, Live Text fallback for iOS - OCR Dashboard: Admin page at /admin/ocr-logs with stats and scan history - Features: Add feature flags in src/config/features.ts - SQL: Add ocr_logs table migration - Services: Update analyze-bottle to use OpenRouter, add save-ocr-log
This commit is contained in:
36
sql/migrate_blind_tasting.sql
Normal file
36
sql/migrate_blind_tasting.sql
Normal file
@@ -0,0 +1,36 @@
|
||||
-- Add Blind Tasting support to Sessions
|
||||
ALTER TABLE public.tasting_sessions
|
||||
ADD COLUMN IF NOT EXISTS is_blind BOOLEAN DEFAULT false,
|
||||
ADD COLUMN IF NOT EXISTS is_revealed BOOLEAN DEFAULT false;
|
||||
|
||||
-- Add Guessing fields to Tastings
|
||||
ALTER TABLE public.tastings
|
||||
ADD COLUMN IF NOT EXISTS blind_label TEXT,
|
||||
ADD COLUMN IF NOT EXISTS guess_abv DECIMAL,
|
||||
ADD COLUMN IF NOT EXISTS guess_age INTEGER,
|
||||
ADD COLUMN IF NOT EXISTS guess_region TEXT,
|
||||
ADD COLUMN IF NOT EXISTS guess_points INTEGER;
|
||||
|
||||
-- Update RLS Policies for blind sessions
|
||||
-- Guests should only see bottle details if NOT blind OR revealed
|
||||
-- This is a complex policy update, we'll refine the existing tastings_select_policy
|
||||
|
||||
DROP POLICY IF EXISTS "tastings_select_policy" ON public.tastings;
|
||||
CREATE POLICY "tastings_select_policy" ON public.tastings FOR SELECT USING (
|
||||
-- You can see your own tastings
|
||||
auth.uid() = user_id
|
||||
OR
|
||||
-- You can see tastings in a session you participate in
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM public.session_participants sp
|
||||
JOIN public.buddies b ON b.id = sp.buddy_id
|
||||
WHERE sp.session_id = public.tastings.session_id
|
||||
AND b.buddy_profile_id = auth.uid()
|
||||
)
|
||||
);
|
||||
|
||||
-- Note: The logic for hiding bottle details will be handled in the UI/API layer
|
||||
-- as the RLS here still needs to allow access to the tasting record itself.
|
||||
-- Hiding 'bottle_id' content for blind tastings will be done in the frontend
|
||||
-- based on session.is_blind and session.is_revealed.
|
||||
Reference in New Issue
Block a user