added and updated models

This commit is contained in:
timurgordon
2025-05-12 01:54:47 +03:00
parent f388fde388
commit 52528ca99f
25 changed files with 734 additions and 182 deletions

View File

@@ -22,9 +22,9 @@ pub enum BusinessType {
// Company represents a company registered in the Freezone
pub struct Company {
base.Base // Base struct for common fields
base.Base // Provides id u32, creation_time, mod_time, comments []u32
pub mut:
id u32
// id u32 is provided by base.Base
name string
registration_number string
incorporation_date ourtime.OurTime
@@ -37,7 +37,7 @@ pub mut:
industry string
description string
status CompanyStatus
created_at ourtime.OurTime
updated_at ourtime.OurTime
// created_at is provided by base.Base.creation_time
// updated_at is provided by base.Base.mod_time
shareholders []Shareholder
}

View File

@@ -1,58 +0,0 @@
module biz
import base
import freeflowuniverse.herolib.data.ourtime
// MeetingStatus represents the status of a meeting
pub enum MeetingStatus {
scheduled
completed
cancelled
}
// AttendeeRole represents the role of an attendee in a meeting
pub enum AttendeeRole {
coordinator
member
secretary
participant
advisor
admin
}
// AttendeeStatus represents the status of an attendee's participation
pub enum AttendeeStatus {
confirmed
pending
declined
}
// Meeting represents a board meeting of a company or other meeting
pub struct Meeting {
base.Base // Base struct for common fields
pub mut:
id u32
company_id u32
title string
date ourtime.OurTime
location string
description string
status MeetingStatus
minutes string
created_at ourtime.OurTime
updated_at ourtime.OurTime
attendees []Attendee
}
// Attendee represents an attendee of a board meeting
pub struct Attendee {
pub mut:
id u32
meeting_id u32
user_id u32
name string
role AttendeeRole
status AttendeeStatus
created_at ourtime.OurTime
}

View File

@@ -18,32 +18,27 @@ pub enum ProductStatus {
unavailable
}
// ProductComponent represents a component of a product
// ProductComponent represents a component or sub-part of a product.
// Its lifecycle is tied to the parent Product and it does not have its own independent ID.
pub struct ProductComponent {
pub mut:
id u32
name string
description string
quantity int
created_at ourtime.OurTime
updated_at ourtime.OurTime
}
// Product represents a product or service offered by the Freezone
// Product represents a product or service offered
pub struct Product {
base.Base // Base struct for common fields
base.Base // Provides id u32, creation_time, mod_time, comments []u32
pub mut:
id u32
name string
description string
price currency.Currency
type_ ProductType
category string
status ProductStatus
created_at ourtime.OurTime
updated_at ourtime.OurTime
max_amount u16 // means allows us to define how many max of this there are
purchase_till ourtime.OurTime
active_till ourtime.OurTime // after this product no longer active if e.g. a service
components []ProductComponent
max_amount u16 // Maximum available quantity of this product, if applicable
purchase_till ourtime.OurTime // Date until which this product can be purchased
active_till ourtime.OurTime // Date until which this product/service remains active (e.g., for subscriptions)
components []ProductComponent // List of components that make up this product
}

View File

@@ -14,28 +14,30 @@ pub enum SaleStatus {
// Sale represents a sale of products or services
pub struct Sale {
base.Base // Base struct for common fields
base.Base // Provides id u32, creation_time, mod_time, comments []u32
pub mut:
id u32
company_id u32
// 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 ourtime.OurTime
updated_at 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
sale_id u32
product_id u32
name string
// 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
unit_price currency.Currency // Price per unit at time of sale
subtotal currency.Currency
active_till ourtime.OurTime // after this product no longer active if e.g. a service
service_active_until ourtime.OurTime? // Optional: For services, date until this specific purchased instance is active
}

View File

@@ -12,16 +12,16 @@ pub enum ShareholderType {
// Shareholder represents a shareholder of a company
pub struct Shareholder {
base.Base // Base struct for common fields
base.Base // Provides id u32, creation_time, mod_time, comments []u32
pub mut:
id u32
company_id u32
user_id u32
name string
shares f64
percentage f64
// id u32 is provided by base.Base
company_id u32 // Reference to Company.id
user_id u32 // Reference to User.id (if individual) or another entity ID (if corporate)
name string // Denormalized name of the shareholder (user or corporate entity)
shares f64 // Number of shares held
percentage f64 // Percentage of ownership
type_ ShareholderType
since ourtime.OurTime
created_at ourtime.OurTime
updated_at ourtime.OurTime
since ourtime.OurTime // Date since becoming a shareholder
// created_at is provided by base.Base.creation_time
// updated_at is provided by base.Base.mod_time
}

View File

@@ -1,51 +0,0 @@
module biz
import base
import freeflowuniverse.herolib.data.ourtime
// VoteStatus represents the status of a vote
pub enum VoteStatus {
open
closed
cancelled
}
// Vote represents a voting item in the Freezone
pub struct Vote {
base.Base // Base struct for common fields
pub mut:
id u32
company_id u32
title string
description string
start_date ourtime.OurTime
end_date ourtime.OurTime
status VoteStatus
created_at ourtime.OurTime
updated_at ourtime.OurTime
options []VoteOption
ballots []Ballot
private_group []u32 // user id's only people who can vote
}
// VoteOption represents an option in a vote
pub struct VoteOption {
pub mut:
id u8
vote_id u32
text string
count int
min_valid int // min votes we need to make total vote count
}
// the vote as done by the user
pub struct Ballot {
pub mut:
id u32
vote_id u32
user_id u32
vote_option_id u8
shares_count int
created_at ourtime.OurTime
}