Update git remote URL from git.threefold.info to git.ourworld.tf
This commit is contained in:
@@ -1,43 +1,35 @@
|
||||
module biz
|
||||
import base
|
||||
|
||||
import freeflowuniverse.herolib.data.ourtime
|
||||
import freeflowuniverse.herolib.hero.models.core
|
||||
|
||||
import freeflowuniverse.herolib.data.currency
|
||||
// Sale represents a transaction linking buyers to products
|
||||
pub struct Sale {
|
||||
core.Base
|
||||
pub mut:
|
||||
company_id u32
|
||||
buyer_id u32
|
||||
transaction_id u32
|
||||
total_amount f64
|
||||
status SaleStatus
|
||||
sale_date u64 // Unix timestamp
|
||||
items []SaleItem
|
||||
notes string
|
||||
}
|
||||
|
||||
// SaleStatus represents the status of a sale
|
||||
// SaleItem captures product details at time of sale
|
||||
pub struct SaleItem {
|
||||
pub mut:
|
||||
product_id u32
|
||||
name string // Product name snapshot
|
||||
quantity i32
|
||||
unit_price f64
|
||||
subtotal f64
|
||||
service_active_until u64 // Optional service expiry
|
||||
}
|
||||
|
||||
// SaleStatus tracks transaction state
|
||||
pub enum SaleStatus {
|
||||
pending
|
||||
completed
|
||||
cancelled
|
||||
}
|
||||
|
||||
// Sale represents a sale of products or services
|
||||
pub struct Sale {
|
||||
base.Base // Provides id u32, creation_time, mod_time, comments []u32
|
||||
pub mut:
|
||||
// id u32 is provided by base.Base
|
||||
company_id u32 // Reference to Company.id that made the sale
|
||||
buyer_name string
|
||||
buyer_email string
|
||||
total_amount currency.Currency
|
||||
status SaleStatus
|
||||
sale_date ourtime.OurTime
|
||||
// created_at is provided by base.Base.creation_time
|
||||
// updated_at is provided by base.Base.mod_time
|
||||
items []SaleItem
|
||||
}
|
||||
|
||||
// SaleItem represents an individual item within a Sale.
|
||||
// Its lifecycle is tied to the parent Sale.
|
||||
pub struct SaleItem {
|
||||
pub mut:
|
||||
// id u32 - Removed, component of Sale
|
||||
// sale_id u32 - Removed, implicit link to parent Sale
|
||||
product_id u32 // Reference to Product.id
|
||||
name string // Denormalized product name at time of sale
|
||||
quantity int
|
||||
unit_price currency.Currency // Price per unit at time of sale
|
||||
subtotal currency.Currency
|
||||
service_active_until ourtime.OurTime? // Optional: For services, date until this specific purchased instance is active
|
||||
}
|
||||
|
Reference in New Issue
Block a user