From 56a17c11872bc52934f4698b42372e148f1e3315 Mon Sep 17 00:00:00 2001 From: Sundog Date: Wed, 18 Oct 2023 12:00:47 -0400 Subject: [PATCH] updates models, adds rusty_money crate dependency --- Cargo.toml | 1 + MODELS.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b1a25df..b7029cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,4 +6,5 @@ edition = "2021" [dependencies] tokio = { version = "1.2", features = ["full"] } warp = "0.3" +rusty-money = "0.4.1" diff --git a/MODELS.md b/MODELS.md index eed6f0e..d056bad 100644 --- a/MODELS.md +++ b/MODELS.md @@ -22,6 +22,7 @@ struct Person { handle: Option, email: Option>, is_active: bool, + is_blocked: bool, created_at: chrono::DateTime, modified_at: chrono::DateTime, modified_by: PersonId, @@ -98,6 +99,7 @@ struct Track { duration: chrono::Duration, artists: HashMap, is_public: bool, + is_available: bool, preview_source: Option, source: String, price: Option, @@ -130,6 +132,7 @@ struct Album { artists: HashMap, tracks: HashMap, is_public: bool, + is_available: bool, preview_source: Option, source: String, price: Option, @@ -233,6 +236,48 @@ struct Comment { } ``` +# Collection + +A Collection represents one or more Albums and/or Tracks that are offered together as a package for Purchase + +``` rust +struct CollectionId { + id: String, +} +struct Collection { + id: CollectionId, + name: String, + description: String, + created_by: Person, + created_at: chrono::DateTime, + modified_by: Person, + modified_at: chrono::DateTime, + is_public: bool, + is_available: bool, + deleted_by: Option, + deleted_at: Option, + albums: Option>, + tracks: Option>, + price: Oprion, +} +``` + +# OtherProduct + +An OtherProduct represents a product that is not a Track, Album, or Collection that is nonetheless for sale as a Purchase. + +``` rust +struct OtherProductId { + id: String, +} +struct OtherProduct { + id: OtherProductId, + name: String, + description: String, + +} +``` + # Purchase A Purchase represents one or more Tracks or Albums that a Person purchases from an Artist or Label through the server. @@ -264,8 +309,20 @@ struct PurchaseItem { quantity: usize, discount_percentage: usize, } +enum PurchaseState { + InCart, + Processing, + PaymentRejected, + PaymentCompleted, + Fulfilled, + Cancelled, + Refunded, +} struct Purchase { id: String, - + items: Vec, + state: PurchaseState, + purchased_by: Person, + purchased_at: Option, } ```