From 8c48abf36afc156258dc33042feac14d15453b6a Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 12:49:54 +0000 Subject: [PATCH] Changes Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com> --- src/integrations/supabase/types.ts | 25 ++++++++++++++++++- ...1_23703083-0333-44bc-bb04-a2eef2d65bb8.sql | 21 ++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 supabase/migrations/20260514124951_23703083-0333-44bc-bb04-a2eef2d65bb8.sql diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index ba7e5bb..3d77ad6 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -14,7 +14,30 @@ export type Database = { } public: { Tables: { - [_ in never]: never + share_rooms: { + Row: { + code: string + created_at: string + expires_at: string + is_active: boolean + viewer_count: number + } + Insert: { + code: string + created_at?: string + expires_at?: string + is_active?: boolean + viewer_count?: number + } + Update: { + code?: string + created_at?: string + expires_at?: string + is_active?: boolean + viewer_count?: number + } + Relationships: [] + } } Views: { [_ in never]: never diff --git a/supabase/migrations/20260514124951_23703083-0333-44bc-bb04-a2eef2d65bb8.sql b/supabase/migrations/20260514124951_23703083-0333-44bc-bb04-a2eef2d65bb8.sql new file mode 100644 index 0000000..c671f59 --- /dev/null +++ b/supabase/migrations/20260514124951_23703083-0333-44bc-bb04-a2eef2d65bb8.sql @@ -0,0 +1,21 @@ +create table public.share_rooms ( + code text primary key, + created_at timestamptz not null default now(), + expires_at timestamptz not null default (now() + interval '4 hours'), + is_active boolean not null default true, + viewer_count int not null default 0 +); + +alter table public.share_rooms enable row level security; + +create policy "anyone can read active rooms" + on public.share_rooms for select + using (is_active = true and expires_at > now()); + +create policy "anyone can create rooms" + on public.share_rooms for insert + with check (true); + +create policy "anyone can update rooms" + on public.share_rooms for update + using (true); \ No newline at end of file