aural_isle/MODELS.md

3.3 KiB

DATA MODELS

This document describes the key top-level entities this application will be working with and the attributes of each. This is a work-in-progress.

Other top-level entities will be introduced to the application as necessary.

Representations in this document are in application context; for database structure, see SCHEMA.md in this directory.

Person

A Person represents a person! Specifically, a Person is a person who is using/has used the web application. Many applications call this entity a "User". We call them a Person.

struct Person {
    id: String,
    remote_id: String,
    name: String,
}

Tag

A Tag is a classification label that a Person wants to associate to a Label, an Artist, an Album, a Track, or a Playlist, used as a way of grouping entities together via some commonality the context of which is not programmatically relevant.

struct Tag {
    id: String,
    name: String,
}

Label

A Label represents a record label (a group of people who handle promotion and/or distribution for one or more Artists).

struct Label {
    id: String,
    name: String,
    description: String,
    website: String,
    artists: HashMap<Artist>,
    tags: HashMap<Tag>,
    comments: HashMap<Comment>,
}

Artist

An Artist represents a musical artist.

struct Artist {
    id: String,
    name: String,
    bio: String,
    website: String,
    tags: HashMap<Tag>,
    comments: HashMap<Comment>,
}

Track

A Track represents a single piece of work by an Artist that is contained in an audio file.

struct Track {
    id: String,
    title: String,
    description: String,
    duration: chrono::Duration,
    artists: HashMap<Artist>,
    created_by: String,
    created_at: chrono::DateTime,
    modified_by: String,
    modified_at: chrono::DateTime,
    deleted_by: Option<String>,
    deleted_at: Option<chrono::DateTime>,
    tags: HashMap<Tag>,
    comments: HashMap<Comment>,
    lyrics: String,
    cover: String,
    images: HashMap<String>,
}

Album

An Album represents a work by an Artist that contains one or more Tracks.

struct Album {
    id: String,
    title: String,
    description: String,
    artists: HashMap<Artist>,
    tracks: HashMap<Track>,
    created_by: String,
    created_at: chrono::DateTime,
    modified_by: String,
    modified_at: chrono::DateTime,
    deleted_by: Option<String>,
    deleted_at: Option<chrono::DateTime>,
    tags: HashMap<Tag>,
    comments: HashMap<Comment>,
    cover: String,
    images: HashMap<String>,
}

Playlist

A Playlist represents an ordered collection of Tracks assembled by a Person.

struct Playlist {
    id: String,
    title: String,
    description: String,
    created_by: String,
    created_at: chrono::DateTime,
    modified_at: chrono::DateTime,
    deleted_at: Option<chrono::DateTime>
    is_public: bool,
    cover: String,
    tracks: HashMap<Track>,
    tags: HashMap<Tag>,
    comments: HashMap<Comment>,
}

Comment

A Comment represents a textual comment that a Person wants to attach contextually to an Artist, an Album, a Track, or a Playlist.

struct Comment {
    id: String,
    body: String,
}

Purchase

A Purchase represents one or more Tracks or Albums that a Person purchases from an Artist or Label through the server.

struct Purchase {
    id: String,
}