model spec

This commit is contained in:
2025-05-09 12:42:42 +03:00
parent d8b40b6995
commit 99bc97b104
16 changed files with 500 additions and 0 deletions

41
specs/models/biz/sale.v Normal file
View 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
}