Skip to content

Latest commit

 

History

History
121 lines (102 loc) · 3.84 KB

data-model.md

File metadata and controls

121 lines (102 loc) · 3.84 KB

Data Model

Three DynamoDB tables, all on-demand (pay-per-request) billing. Single-table design was considered and rejected for this project size — see decisions.md.

Events table

Attribute Type Notes
eventId (PK) S evt_<ulid>
organizerId S Cognito sub of the creating organizer
organizerEmail S denormalized for notification emails without a lookup
title S
description S
category S e.g. WORKSHOP, CONFERENCE, SOCIAL
location S free text or "Virtual"
startDate S ISO-8601
endDate S ISO-8601
capacity N max registrations, 0 = unlimited
registeredCount N maintained via atomic counter on registration/cancellation
ticketLink S organizer-provided URL (Eventbrite, Zoom, download, etc.)
status S PENDING_REVIEW | APPROVED | REJECTED | CANCELLED
rejectionReason S present only when status = REJECTED
createdAt / updatedAt S ISO-8601

GSI1 StatusStartDateIndex — PK status, SK startDate Powers the public "browse approved upcoming events" listing without a scan.

GSI2 OrganizerIndex — PK organizerId, SK createdAt Powers "an organizer's own events across all statuses".

Registrations table

Attribute Type Notes
eventId (PK) S
userId (SK) S Cognito sub of the registrant — composite key also enforces "one registration per user per event"
registrationId S reg_<ulid>, used as an external-facing id
userEmail S denormalized for confirmation email
status S REGISTERED | CANCELLED
ticketLink S snapshot of the event's ticket link at registration time
registeredAt S ISO-8601
cancelledAt S present only when cancelled

GSI1 UserIndex — PK userId, SK registeredAt Powers "a user's own registrations" (their ticket history).

Users table

Cognito is the source of truth for credentials; this table stores profile data outside of what's convenient to keep in Cognito attributes, and gives Admins a fast, queryable list of accounts without paging through ListUsers on the User Pool.

Attribute Type Notes
userId (PK) S Cognito sub
email S
name S
role S ADMIN | ORGANIZER | USER — mirrors Cognito group membership
createdAt S ISO-8601

GSI1 RoleIndex — PK role, SK createdAt Powers Admin's "list all organizers" / "list all users" screens.

Populated by the Cognito Post-Confirmation Lambda trigger at sign-up time, so it always exists before the user makes their first API call.

Entity relationship

erDiagram
    USERS ||--o{ EVENTS : organizes
    USERS ||--o{ REGISTRATIONS : registers
    EVENTS ||--o{ REGISTRATIONS : "has"

    USERS {
        string userId PK
        string email
        string name
        string role
    }
    EVENTS {
        string eventId PK
        string organizerId
        string title
        string status
        number capacity
        number registeredCount
        string ticketLink
    }
    REGISTRATIONS {
        string eventId PK
        string userId SK
        string status
        string ticketLink
        string registeredAt
    }
Loading

Status lifecycles

stateDiagram-v2
    [*] --> PENDING_REVIEW: Organizer creates event
    PENDING_REVIEW --> APPROVED: Admin approves
    PENDING_REVIEW --> REJECTED: Admin rejects (reason required)
    APPROVED --> CANCELLED: Organizer or Admin cancels
    REJECTED --> [*]
    CANCELLED --> [*]
    APPROVED --> [*]
Loading
stateDiagram-v2
    [*] --> REGISTERED: User registers (capacity permitting)
    REGISTERED --> CANCELLED: User cancels
    CANCELLED --> [*]
    REGISTERED --> [*]
Loading