model spec
This commit is contained in:
41
specs/models/biz/sale.v
Normal file
41
specs/models/biz/sale.v
Normal file
@@ -0,0 +1,41 @@
|
||||
module biz
|
||||
import base
|
||||
|
||||
import freeflowuniverse.herolib.data.ourtime
|
||||
|
||||
import freeflowuniverse.herolib.data.currency
|
||||
|
||||
// SaleStatus represents the status of a sale
|
||||
pub enum SaleStatus {
|
||||
pending
|
||||
completed
|
||||
cancelled
|
||||
}
|
||||
|
||||
// Sale represents a sale of products or services
|
||||
pub struct Sale {
|
||||
base.Base // Base struct for common fields
|
||||
pub mut:
|
||||
id u32
|
||||
company_id u32
|
||||
buyer_name string
|
||||
buyer_email string
|
||||
total_amount currency.Currency
|
||||
status SaleStatus
|
||||
sale_date ourtime.OurTime
|
||||
created_at ourtime.OurTime
|
||||
updated_at ourtime.OurTime
|
||||
items []SaleItem
|
||||
}
|
||||
|
||||
pub struct SaleItem {
|
||||
pub mut:
|
||||
id u32
|
||||
sale_id u32
|
||||
product_id u32
|
||||
name string
|
||||
quantity int
|
||||
unit_price currency.Currency
|
||||
subtotal currency.Currency
|
||||
active_till ourtime.OurTime // after this product no longer active if e.g. a service
|
||||
}
|
Reference in New Issue
Block a user