Community engagement
tracked_links
A promoter's (or influencer's) personal link to one event: /events/<slug>?via=<code>. One per promoter page + event. The caption cached here is the kit caption written for this promoter (promo_kit), so it isn't rewritten on every call.
Columns
| Column | Type | Null | Default | Keys |
|---|---|---|---|---|
| id | uuid | no | gen_random_uuid() | PK |
| code | text | no | — | unique |
| event_id | uuid | no | — | |
| profile_id | uuid | no | — | |
| created_by | uuid | yes | — | |
| caption | jsonb | yes | — | |
| created_at | timestamp | no | now() |
Value lists come from .$type<'a' | 'b'>() in the schema — enforced in TypeScript only, not by the database.
Keys, constraints & indexes
Unique
- (code) tracked_links_code_unique
- (event_id, profile_id) tracked_links_event_profile
Indexes
- (profile_id)tracked_links_profile_idx
Foreign keys
- event_id → events.id on delete cascade
- profile_id → profiles.id on delete cascade
- created_by → dancers.id on delete set null
Referenced by
- tracked_link_actions (link_id)
Used by
Code that reads or writes this table, found by static analysis of the tRPC routers and API handlers (including helpers they call).
tRPC procedures
REST & webhooks
- GET /api/qr/:file
- POST /api/stripe/webhook
- ANY /mcp
- ANY /mcp/public
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
}
profiles {
uuid id PK
text username UK
}
tracked_link_actions {
uuid id PK
uuid link_id FK
uuid dancer_id FK
}
tracked_links {
uuid id PK
text code UK
uuid event_id FK
uuid profile_id FK
uuid created_by FK
}
profiles |o--o{ events : "host_profile_id"
dancers |o--o{ events : "edited_by"
tracked_links ||--o{ tracked_link_actions : "link_id"
dancers |o--o{ tracked_link_actions : "dancer_id"
events ||--o{ tracked_links : "event_id"
profiles ||--o{ tracked_links : "profile_id"
dancers |o--o{ tracked_links : "created_by" Defined at server/database/schema.ts:1443 as trackedLinks.