mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
Initial commit
This commit is contained in:
commit
4d53d83769
73 files changed
+37728
No files matched your search
@@ -0,0 +1,21 @@
|
||||
-- Add read_at column
|
||||
ALTER TABLE public.messages ADD COLUMN IF NOT EXISTS read_at TIMESTAMPTZ;
|
||||
|
||||
-- Allow users to update read_at for messages where they are NOT the sender
|
||||
CREATE POLICY "Users can mark messages as read"
|
||||
ON public.messages
|
||||
FOR UPDATE
|
||||
USING (
|
||||
auth.uid() != user_id AND
|
||||
EXISTS (
|
||||
SELECT 1 FROM public.matches m
|
||||
WHERE m.id = messages.match_id
|
||||
AND m.couple_id IN (
|
||||
SELECT couple_id FROM public.profiles
|
||||
WHERE id = auth.uid()
|
||||
)
|
||||
)
|
||||
)
|
||||
WITH CHECK (
|
||||
auth.uid() != user_id
|
||||
);
|
||||
Reference in new issue
Block a user