Skip to content

rcciit-swc/techtrix-2023

Repository files navigation

Techtrix, RCCIIT

Stack

Next.JS + Supabase + TailwindCSS + Vercel

Tables

Users

create table
  public.users (
    id uuid not null,
    email text null,
    name text null,
    role text not null default 'participant'::text,
    phone text null,
    college text null,
    year text null,
    coordinating_event_id smallint null,
    convening_event_category text null,
    constraint users_pkey primary key (id),
    constraint users_email_key unique (email),
    constraint users_id_fkey foreign key (id) references auth.users (id) on delete cascade,
    constraint users_convening_event_category_fkey foreign key (convening_event_category) references event_categories (name),
    constraint users_coordinating_event_id_fkey foreign key (coordinating_event_id) references events (id),
    constraint year_check check (
      (
        (length(year) = 4)
        or (length(coalesce(year, ''::text)) = 0)
      )
    ),
    constraint phone_number_check check (
      (
        (length(phone) = 10)
        or (length(coalesce(phone, ''::text)) = 0)
      )
    ),
    constraint check_role_type check (
      (
        (role = 'participant'::text)
        or (role = 'event_manager'::text)
        or (role = 'convenor'::text)
        or (role = 'coordinator'::text)
        or (role = 'superadmin'::text)
        or (role = 'finance_manager'::text)
      )
    )
  ) tablespace pg_default;

Events

create table
  public.events (
    id smallint generated by default as identity not null,
    name text not null,
    type text not null,
    team_size smallint not null,
    rules_regulations character varying not null,
    is_open boolean not null,
    poster_image text null,
    category text null,
    details text null,
    min_team_size smallint not null,
    multiple_registrations_allowed boolean not null default false,
    fees smallint null default '0'::smallint,
    constraint events_pkey primary key (id),
    constraint events_category_fkey foreign key (category) references event_categories (name),
    constraint events_type_check check (
      (
        (
          type = 'TEAM'::text
        )
        or (
          type = 'SOLO'::text
        )
      )
    )
  ) tablespace pg_default;

Event Categories

create table
  public.event_categories (
    id smallint generated by default as identity not null,
    name text not null,
    picture text null default ''::text,
    description text null,
    constraint event_categories_pkey primary key (name),
    constraint event_categories_id_key unique (id)
  ) tablespace pg_default;

Participation

create table
  public.participation (
    team_name text null,
    team_member_1 text null,
    team_member_2 text null,
    team_member_3 text null,
    team_member_4 text null,
    team_member_5 text null,
    event_id smallint not null,
    transaction_id text null,
    transaction_verified boolean null default false,
    team_member_0 text null,
    id uuid not null default uuid_generate_v4 (),
    registered_by text not null,
    registration_cancelled boolean null default false,
    valorant_id array null,
    transaction_screenshot_file_name text null,
    upi_id text null,
    phone_number text null,
    time_stamp timestamp with time zone null default now(),
    constraint participation_pkey primary key (id),
    constraint participation_id_key unique (id),
    constraint participation_team_member_0_fkey foreign key (team_member_0) references users (email),
    constraint participation_team_member_1_fkey foreign key (team_member_1) references users (email),
    constraint participation_team_member_2_fkey foreign key (team_member_2) references users (email),
    constraint participation_team_member_3_fkey foreign key (team_member_3) references users (email),
    constraint participation_team_member_4_fkey foreign key (team_member_4) references users (email),
    constraint participation_team_member_5_fkey foreign key (team_member_5) references users (email),
    constraint participation_event_id_fkey foreign key (event_id) references events (id),
    constraint participation_registered_by_fkey foreign key (registered_by) references users (email),
    constraint team_name_not_null_if_team_member_0_not_null check (
      (
        (
          (team_name is not null)
          and (team_member_0 is not null)
        )
        or (team_member_0 is null)
      )
    ),
    constraint unique_team_members check (
      (
        (team_member_0 <> team_member_1)
        and (team_member_0 <> team_member_2)
        and (team_member_0 <> team_member_3)
        and (team_member_0 <> team_member_4)
        and (team_member_0 <> team_member_5)
        and (team_member_1 <> team_member_2)
        and (team_member_1 <> team_member_3)
        and (team_member_1 <> team_member_4)
        and (team_member_1 <> team_member_5)
        and (team_member_2 <> team_member_3)
        and (team_member_2 <> team_member_4)
        and (team_member_2 <> team_member_5)
        and (team_member_3 <> team_member_4)
        and (team_member_3 <> team_member_5)
        and (team_member_4 <> team_member_5)
      )
    )
  ) tablespace pg_default;