more model refinement

This commit is contained in:
cascode _ 2023-10-20 09:37:57 -04:00 committed by cascode
parent b31436b116
commit 1247acc413
1 changed files with 15 additions and 29 deletions

View File

@ -287,23 +287,14 @@ struct Article {
A Comment represents a textual comment that a Person wants to attach contextually to an Artist, an Album, a Track, or a Playlist. A Comment represents a textual comment that a Person wants to attach contextually to an Artist, an Album, a Track, or a Playlist.
``` rust ``` rust
enum CommentTargetType { enum CommentTarget {
Label, Label(LabelId),
Artist, Artist(ArtistId),
Album, Album(AlbumId),
Track, Track(TrackId),
Playlist, Playlist(PlaylistId),
Article, Article(ArticleId),
Comment, Comment(CommentId),
}
struct CommentTargetId {
label_id: Option<LabelId>,
artist_id: Option<ArtistId>,
album_id: Option<AlbumId>,
track_id: Option<TrackId>,
playlist_id: Option<PlaylistId>,
article_id: Option<ArticleId>,
comment_id: Option<CommentId>,
} }
struct CommentId { struct CommentId {
id: String, id: String,
@ -311,8 +302,7 @@ struct CommentId {
struct Comment { struct Comment {
id: CommentId, id: CommentId,
body: String, body: String,
target_type: CommentTargetType, target: CommentTarget,
target_id: CommentTargetId,
created_by: PersonId, created_by: PersonId,
created_at: chrono::DateTime, created_at: chrono::DateTime,
modified_by: Option<PersonId>, modified_by: Option<PersonId>,
@ -436,10 +426,10 @@ A Purchase represents one or more Tracks or Albums that a Person purchases from
``` rust ``` rust
enum PurchaseItemType { enum PurchaseItemType {
Album, Album(AlbumId),
Track, Track(TrackId),
Collection, Collection(CollectionId),
OtherProduct, OtherProduct(OtherProductId),
} }
struct PurchaseItemId { struct PurchaseItemId {
id: String, id: String,
@ -449,10 +439,7 @@ struct SkuId {
} }
struct Sku { struct Sku {
id: SkuId, id: SkuId,
album_id: Option<AlbumId>, item: PurchaseItemType,
track_id: Option<TrackId>,
collection_id: Option<CollectionId>,
other_product_id: Option<OtherProductId>,
variant: Option<String>, variant: Option<String>,
description: Option<String>, description: Option<String>,
price: Option<rusty_money::Money>, price: Option<rusty_money::Money>,
@ -460,8 +447,7 @@ struct Sku {
} }
struct PurchaseItem { struct PurchaseItem {
id: PurchaseItemId, id: PurchaseItemId,
type: PurchaseItemType, sku: SkuId,
sku: Option<SkuId>,
quantity: usize, quantity: usize,
} }
enum PurchaseState { enum PurchaseState {