From cb3f76aa177e706f98cf694f3c10024ad241f4bc Mon Sep 17 00:00:00 2001 From: Sundog Date: Fri, 20 Oct 2023 09:32:52 -0400 Subject: [PATCH] refines MODELS around cart functionality, moves all pricing into Sku model, adds CouponCode model --- MODELS.md | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/MODELS.md b/MODELS.md index 2566619..8be6a47 100644 --- a/MODELS.md +++ b/MODELS.md @@ -185,7 +185,6 @@ struct Track { is_available: bool, preview_source: Option, source: String, - price: Option, created_by: PersonId, created_at: chrono::DateTime, modified_by: PersonId, @@ -218,7 +217,6 @@ struct Album { is_available: bool, preview_source: Option, source: String, - price: Option, created_by: PersonId, created_at: chrono::DateTime, modified_by: PersonId, @@ -405,7 +403,6 @@ struct Collection { albums: Option>, tracks: Option>, other_products: Option>, - price: Option, } ``` @@ -429,7 +426,7 @@ struct OtherProduct { is_available: bool, deleted_by: Option, deleted_at: Option, - price: Option + requires_shipping: bool, } ``` @@ -457,8 +454,9 @@ struct Sku { collection_id: Option, other_product_id: Option, variant: Option, - discount_percentage: Option, - discount_flatrate: Option, + description: Option, + price: Option, + requires_shipping: bool, } struct PurchaseItem { id: PurchaseItemId, @@ -481,5 +479,35 @@ struct Purchase { state: PurchaseState, purchased_by: Person, purchased_at: Option, + fulfilled_by: Option, + fulfilled_at: Option, } ``` + +# CouponCode + +A CouponCode represents a code a Person can enter to receive a discount on a PurchateItem or on a Purchase. + +``` rust +struct CouponCodeId { + id: String, +} +struct CouponCode { + id: CouponCodeId, + name: String, + code: String, + uses: usize, + max_uses: usize, + expiration: Option, + discount_flat: Option, + discount_percentage: Option, + skus: Option>, + is_active: bool, + created_by: PersonId, + created_at: chrono::DateTime, + modified_by: PersonId, + modified_at: chrono::DateTime, + deleted_by: Option, + deleted_at: Option, +} +``` \ No newline at end of file