db/specs/models/biz/sale.v
2025-05-09 12:42:42 +03:00

42 lines
862 B
V

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
}