updates models, adds rusty_money crate dependency
This commit is contained in:
parent
25dc8413dd
commit
c1626d920a
|
@ -6,4 +6,5 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tokio = { version = "1.2", features = ["full"] }
|
tokio = { version = "1.2", features = ["full"] }
|
||||||
warp = "0.3"
|
warp = "0.3"
|
||||||
|
rusty-money = "0.4.1"
|
||||||
|
|
||||||
|
|
59
MODELS.md
59
MODELS.md
|
@ -22,6 +22,7 @@ struct Person {
|
||||||
handle: Option<String>,
|
handle: Option<String>,
|
||||||
email: Option<Vec<String>>,
|
email: Option<Vec<String>>,
|
||||||
is_active: bool,
|
is_active: bool,
|
||||||
|
is_blocked: bool,
|
||||||
created_at: chrono::DateTime,
|
created_at: chrono::DateTime,
|
||||||
modified_at: chrono::DateTime,
|
modified_at: chrono::DateTime,
|
||||||
modified_by: PersonId,
|
modified_by: PersonId,
|
||||||
|
@ -98,6 +99,7 @@ struct Track {
|
||||||
duration: chrono::Duration,
|
duration: chrono::Duration,
|
||||||
artists: HashMap<Artist>,
|
artists: HashMap<Artist>,
|
||||||
is_public: bool,
|
is_public: bool,
|
||||||
|
is_available: bool,
|
||||||
preview_source: Option<String>,
|
preview_source: Option<String>,
|
||||||
source: String,
|
source: String,
|
||||||
price: Option<rusty_money::Money>,
|
price: Option<rusty_money::Money>,
|
||||||
|
@ -130,6 +132,7 @@ struct Album {
|
||||||
artists: HashMap<Artist>,
|
artists: HashMap<Artist>,
|
||||||
tracks: HashMap<Track>,
|
tracks: HashMap<Track>,
|
||||||
is_public: bool,
|
is_public: bool,
|
||||||
|
is_available: bool,
|
||||||
preview_source: Option<String>,
|
preview_source: Option<String>,
|
||||||
source: String,
|
source: String,
|
||||||
price: Option<rusty_money::Money>,
|
price: Option<rusty_money::Money>,
|
||||||
|
@ -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<Person>,
|
||||||
|
deleted_at: Option<chrono::DateTime>,
|
||||||
|
albums: Option<Vec<Album>>,
|
||||||
|
tracks: Option<Vec<Track>>,
|
||||||
|
price: Oprion<rusty_money::Money>,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
# 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
|
# Purchase
|
||||||
|
|
||||||
A Purchase represents one or more Tracks or Albums that a Person purchases from an Artist or Label through the server.
|
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,
|
quantity: usize,
|
||||||
discount_percentage: usize,
|
discount_percentage: usize,
|
||||||
}
|
}
|
||||||
|
enum PurchaseState {
|
||||||
|
InCart,
|
||||||
|
Processing,
|
||||||
|
PaymentRejected,
|
||||||
|
PaymentCompleted,
|
||||||
|
Fulfilled,
|
||||||
|
Cancelled,
|
||||||
|
Refunded,
|
||||||
|
}
|
||||||
struct Purchase {
|
struct Purchase {
|
||||||
id: String,
|
id: String,
|
||||||
|
items: Vec<PurchaseItem>,
|
||||||
|
state: PurchaseState,
|
||||||
|
purchased_by: Person,
|
||||||
|
purchased_at: Option<chrono::DateTime>,
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue