From e30c794c980b67a5e16eabc0d40d06ffbceac304 Mon Sep 17 00:00:00 2001 From: Sundog Date: Tue, 17 Oct 2023 17:27:09 -0400 Subject: [PATCH] updates ARCHITECTURE, adds MODELS and SCHEMA docs --- ARCHITECTURE.md | 4 +- MODELS.md | 153 ++++++++++++++++++++++++++++++++++++++++++++++++ SCHEMA.md | 1 + 3 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 MODELS.md create mode 100644 SCHEMA.md diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 317c99b..828f261 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -4,4 +4,6 @@ This is a living document describing the architectural decisions made as part of ## Base Architectural Decisions -At the inception of the project, we decided to use Rust as our language of choice and Warp as our web framework. This decision was based on team skills, future capabilities, and current best practices for building web applications in Rust. \ No newline at end of file +At the inception of the project, we decided to use Rust as our language of choice and Warp as our web framework. This decision was based on team skills, future capabilities, and current best practices for building web applications in Rust. + +We also decided to start with sqlite as our datastore for simplicity and minimal resource usage. We fully anticipate supporting alternate datastores in future versions. diff --git a/MODELS.md b/MODELS.md new file mode 100644 index 0000000..95d32d2 --- /dev/null +++ b/MODELS.md @@ -0,0 +1,153 @@ +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. + +``` rust +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. + +``` rust +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). + +``` rust +struct Label { + id: String, + name: String, + description: String, + website: String, + artists: HashMap, + tags: HashMap, + comments: HashMap, +} +``` + +# Artist + +An Artist represents a musical artist. + +``` rust +struct Artist { + id: String, + name: String, + bio: String, + website: String, + tags: HashMap, + comments: HashMap, +} +``` + +# Track + +A Track represents a single piece of work by an Artist that is contained in an audio file. + +``` rust +struct Track { + id: String, + title: String, + description: String, + duration: chrono::Duration, + artists: HashMap, + created_by: String, + created_at: chrono::DateTime, + modified_by: String, + modified_at: chrono::DateTime, + deleted_by: Option, + deleted_at: Option, + tags: HashMap, + comments: HashMap, + lyrics: String, + cover: String, + images: HashMap, +} +``` + +# Album + +An Album represents a work by an Artist that contains one or more Tracks. + +``` rust +struct Album { + id: String, + title: String, + description: String, + artists: HashMap, + tracks: HashMap, + created_by: String, + created_at: chrono::DateTime, + modified_by: String, + modified_at: chrono::DateTime, + deleted_by: Option, + deleted_at: Option, + tags: HashMap, + comments: HashMap, + cover: String, + images: HashMap, +} +``` + +# Playlist + +A Playlist represents an ordered collection of Tracks assembled by a Person. + +``` rust +struct Playlist { + id: String, + title: String, + description: String, + created_by: String, + created_at: chrono::DateTime, + modified_at: chrono::DateTime, + deleted_at: Option + is_public: bool, + cover: String, + tracks: HashMap, + tags: HashMap, + comments: HashMap, +} +``` + +# Comment + +A Comment represents a textual comment that a Person wants to attach contextually to an Artist, an Album, a Track, or a Playlist. + +``` rust +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. + +``` rust +struct Purchase { + id: String, +} +``` diff --git a/SCHEMA.md b/SCHEMA.md new file mode 100644 index 0000000..f87f5c1 --- /dev/null +++ b/SCHEMA.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file