Skip to content

Latest commit

 

History

History
187 lines (149 loc) · 3.48 KB

database-structure.md

File metadata and controls

187 lines (149 loc) · 3.48 KB

Database Structure

twigl uses Firebase Realtime Database to manage data of the broadcast mode.

director

director is an object from director ID to Director.

Director is like a user per session. Director has information about the director.

interface Director {
    /**
     * The screen name of the director.
     */
    name: string;
};

channel

channel is an object from channel ID to Channel.

Channel has code, cursor position, and stuff for the channel.

It also has three director IDs:

  • director ID for the screen name and the session URL
  • director ID represents the graphics coder (VJ)
  • director ID represents the sound coder (DJ)
/**
 * Mode of the regulation in the graphics code.
 */
enum GraphicsMode {
    Classic = 0,
    Geek = 1,
    Geeker = 2,
    Geekest = 3,
    Classic300 = 4,
    Geek300 = 5,
    Geeker300 = 6,
    Geekest300 = 7,
    ClassicMRT = 8,
    GeekMRT = 9,
    GeekerMRT = 10,
    GeekestMRT = 11,
}

interface Channel {
    /**
     * The director ID for the Channel.
     */
    directorId: string;

    /**
     * The director ID of the graphics coder (VJ).
     * It can be `'unknown'` if the coder is not there.
     */
    visual: string;

    /**
     * The director ID of the sound coder (DJ).
     * It can be `'unknown'` if the coder is not there.
     */
    disc: string;

    /**
     * Always `true`?
     */
    initialized: boolean;

    graphics: {
        /**
         * Represents the current cursor position.
         * row, column, and scrollTop.
         * They are represented in the format like `'10|22|2'`.
         */
        cursor: string;

        /**
         * The current graphics mode (regulation)
         */
        mode: GraphicsMode;

        /**
         * The GLSL code of the graphics.
         */
        source: string;
    };

    sound: {
        /**
         * Represents the current cursor position.
         * row, column, and scrollTop.
         * They are represented in the format like `'10|22|2'`.
         */
        cursor: string;

        /**
         * The counter increments when the coder hits the play button.
         */
        play: number;

        /**
         * The GLSL code of the sound.
         */
        source: string;
    }
}

viewer

viewer is an object from channel ID to Viewer.

Viewer has information about viewers of the channel.

interface Viewer {
    /**
     * The counter represents the current viewer.
     */
    count: number;
}

star

star is an object from channel ID to Star.

Star has information about reactions (♥) to the channel.

interface Star {
    /**
     * The counter represents the current reaction count (♥).
     */
    count: number;
}

snapshot

snapshot is an object from snapshot ID to Snapshot.

Snapshot corresponds to a single generated link of a shader.

interface Snapshot {
    graphics: {
        /**
         * The current graphics mode (regulation)
         */
        mode: GraphicsMode;

        /**
         * The GLSL code of the graphics.
         */
        source: string;
    };

    sound: {
        /**
         * The GLSL code of the sound.
         */
        source: string;
    } | null;

    /**
     * The date when the snapshot was saved, in unix epoch.
     */
    date: number;

    /**
     * The view count.
     */
    viewCount: number;

    /**
     * The reaction count.
     */
    starCount: number;
}