Skip to content

SeryiBaran/telehumpter

Repository files navigation

telehumpter

Недо-пародия на твиттер на Supabase+Vue.

Технологии

Схема Supabase

Схема posts

create table
  public.posts (
    id bigint generated by default as identity not null,
    created_at timestamp with time zone null default now(),
    content text not null default ''::text,
    authorId uuid not null,
    constraint posts_pkey primary key (id),
    constraint posts_authorId_fkey foreign key ("authorId") references profiles (id) on delete cascade
  ) tablespace pg_default;

Схема profiles

create table
  public.profiles (
    id uuid not null,
    username text not null,
    constraint profiles_pkey primary key (id),
    constraint profiles_username_key unique (username),
    constraint profiles_id_fkey foreign key (id) references auth.users (id) on delete cascade
  ) tablespace pg_default;

Права

Права posts

Операция Права
INSERT All users can create posts.
SELECT All users can view posts.
INSERT Individuals can create posts.
DELETE Individuals can delete their own posts.
UPDATE Individuals can update their own posts.

Права profiles

Операция Права
INSERT All users can create profiles.
SELECT All users can view profiles.
UPDATE Individuals can update their own profiles.

Генерация типов из БД

Авторизуйтесь:

npx supabase login

Сгенерируйте типы:

npx supabase gen types typescript --project-id АЙДИ_ПРОЕКТА --schema public > src/types/supabase.ts