updates ARCHITECTURE, adds MODELS and SCHEMA docs

This commit is contained in:
Sundog 2023-10-17 17:27:09 -04:00
parent 60cc6cc9e0
commit e30c794c98
3 changed files with 157 additions and 1 deletions

View File

@ -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.
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.

153
MODELS.md Normal file
View File

@ -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<Artist>,
tags: HashMap<Tag>,
comments: HashMap<Comment>,
}
```
# Artist
An Artist represents a musical artist.
``` rust
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.
``` rust
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.
``` rust
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.
``` rust
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.
``` 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,
}
```

1
SCHEMA.md Normal file
View File

@ -0,0 +1 @@
# TODO