Database Entities

natPortal’s database will store most data related to its features. However, as a client portal interacting with external decoupled applications, not all user data is stored in one place.

This document describes the schema of each entity within the natPortal database, as well as briefly referencing the data external to the natPortal database, which are critical to the features of natPortal.

Database models of event services

erDiagram
    direction LR
    User ||--o{ FormResponse : fills
    Form ||--o{ FormResponse : defines

    Event ||..o{ Form : has
    Event ||--o{ Participation : has
    User  ||--o{ Participation : has


    User {
        string      user_id             PK
        string      name
        string      email               UK
    }
    Event {
        string      event_id            PK
        boolean     published
    }
    Participation {
        string      user_id             PK,FK
        string      event_id            PK,FK
        string      role
        boolean     approved
    }
    Form {
        string      form_id             PK
        JSONB       form_schema
        JSONB       ui_schema
        boolean     fill_once
        string      price_id
        string      event_id            FK
    }
    FormResponse {
        UUID        form_response_id    PK
        string      form_id             FK
        string      user_id             FK
        JSONB       form_input
        JSONB       callback_data
    }

Database models of frontend display service

erDiagram
    direction LR

    Page }o--o{ PageCard : contains
    Card }o--o{ PageCard : "displayed by"

    Card }o..o| Media : presents
    Card ||--o{ Action : uses

    Page {
        int         page_id             PK      "Increments"
        enum        slug                        "The uppercase page suffix associated with this page"
        string      title
        string      content                     "Markdown enabled string"
        timestamp   created_at
        timestamp   updated_at
    }
    Media {
        int         media_id            PK      "Increments"
        string      url                         "URL to a resource"
        string      alt_text
        timestamp   uploaded_at
    }
    Action {
        int         action_id           PK      "Increments"
        string      href
        string      cta_text
        int         card_id             FK
    }
    Card {
        int         card_id             PK      "Increments"
        int         media_id            FK      "NULLABLE relation"
        string      title
        string[]    tags
        string      content                     "Markdown enabledd string"
        timestamp   date
        boolean     is_highlighted              "Default false"
    }
    PageCard {
        int         page_id             PK,FK
        int         card_id             PK,FK
    }