Skip to content
Community engagement

giveaway_proposals

A promoter/influencer proposes a giveaway for an event; only admins create giveaways directly, so the event's organizer approves it and it becomes one.

Columns

ColumnTypeNullDefaultKeys
iduuid nogen_random_uuid()
PK
event_iduuid no—
proposed_byuuid yes—
profile_iduuid no—
prizetext no—
descriptiontext no""
sponsor_nametext yes—
ends_attimestamp yes—
statustext
pendingapproveddeclined
no"pending"
notetext yes—
giveaway_iduuid yes—
decided_byuuid yes—
decided_attimestamp yes—
created_attimestamp nonow()

Value lists come from .$type<'a' | 'b'>() in the schema — enforced in TypeScript only, not by the database.

Keys, constraints & indexes

Unique

None besides the primary key.

Indexes

  • (event_id, status)
    giveaway_proposals_event_idx
  • (profile_id)
    giveaway_proposals_profile_idx

Foreign keys

  • event_id → events.id
    on delete cascade
  • proposed_by → dancers.id
    on delete set null
  • profile_id → profiles.id
    on delete cascade
  • giveaway_id → giveaways.id
    on delete set null
  • decided_by → dancers.id
    on delete set null

Used by

Code that reads or writes this table, found by static analysis of the tRPC routers and API handlers (including helpers they call).

Relations

Rendering diagram…

Diagram source
erDiagram
  dancers {
    uuid id PK
    text email UK
    text neon_auth_id UK
    text username UK
  }
  events {
    uuid id PK
    uuid host_profile_id FK
    uuid edited_by FK
  }
  giveaway_proposals {
    uuid id PK
    uuid event_id FK
    uuid proposed_by FK
    uuid profile_id FK
    uuid giveaway_id FK
    uuid decided_by FK
  }
  giveaways {
    uuid id PK
  }
  profiles {
    uuid id PK
    text username UK
  }
  profiles |o--o{ events : "host_profile_id"
  dancers |o--o{ events : "edited_by"
  events ||--o{ giveaway_proposals : "event_id"
  dancers |o--o{ giveaway_proposals : "proposed_by"
  profiles ||--o{ giveaway_proposals : "profile_id"
  giveaways |o--o{ giveaway_proposals : "giveaway_id"
  dancers |o--o{ giveaway_proposals : "decided_by"

Defined at server/database/schema.ts:1496 as giveawayProposals.