Changes
Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com>
This commit is contained in:
@@ -14,7 +14,30 @@ export type Database = {
|
|||||||
}
|
}
|
||||||
public: {
|
public: {
|
||||||
Tables: {
|
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: {
|
Views: {
|
||||||
[_ in never]: never
|
[_ in never]: never
|
||||||
|
|||||||
@@ -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);
|
||||||
Reference in New Issue
Block a user