chore: clean up diagnostic logs and update walkthrough

This commit is contained in:
2025-12-18 11:32:16 +01:00
parent 5923dd0474
commit 2685176992
2 changed files with 14 additions and 14 deletions

View File

@@ -148,6 +148,14 @@ CREATE POLICY "Users can manage their own buddies" ON buddies
CREATE POLICY "Users can see buddies linked to their profile" ON buddies
FOR SELECT USING (buddy_profile_id = auth.uid());
-- TASTINGS (Core Table)
ALTER TABLE tastings ENABLE ROW LEVEL SECURITY;
-- SIMPLEST POLICY: You see your own stuff.
-- No subqueries = No recursion.
CREATE POLICY "tastings_owner_policy" ON tastings
FOR ALL USING (auth.uid() = user_id);
-- Policies for Tasting Sessions
ALTER TABLE tasting_sessions ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Users can manage their own sessions" ON tasting_sessions
@@ -160,23 +168,15 @@ CREATE POLICY "Users can see sessions they participate in" ON tasting_sessions
)
);
-- Policies for Session Participants
-- SESSION PARTICIPANTS
ALTER TABLE session_participants ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Users can manage their own session participants" ON session_participants
CREATE POLICY "session_participants_owner_policy" ON session_participants
FOR ALL USING (auth.uid() = user_id);
CREATE POLICY "Participants can see session membership" ON session_participants
FOR SELECT USING (
buddy_id IN (SELECT id FROM buddies WHERE buddy_profile_id = auth.uid())
);
-- Policies for Tasting Tags
-- TASTING TAGS
ALTER TABLE tasting_tags ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Users can manage their own tasting tags" ON tasting_tags
CREATE POLICY "tasting_tags_owner_policy" ON tasting_tags
FOR ALL USING (auth.uid() = user_id);
CREATE POLICY "Tagged users can see the tags" ON tasting_tags
FOR SELECT USING (
buddy_id IN (SELECT id FROM buddies WHERE buddy_profile_id = auth.uid())
);
-- STORAGE SETUP
-- Create 'bottles' bucket if it doesn't exist