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

View File

@@ -0,0 +1,43 @@
module biz
import base
import freeflowuniverse.herolib.data.ourtime
// CompanyStatus represents the status of a company
pub enum CompanyStatus {
active
inactive
suspended
}
// BusinessType represents the type of a business
pub enum BusinessType {
coop
single
twin
starter
global
}
// Company represents a company registered in the Freezone
pub struct Company {
base.Base // Base struct for common fields
pub mut:
id u32
name string
registration_number string
incorporation_date ourtime.OurTime
fiscal_year_end string
email string
phone string
website string
address string
business_type BusinessType
industry string
description string
status CompanyStatus
created_at ourtime.OurTime
updated_at ourtime.OurTime
shareholders []Shareholder
}

View File

@@ -0,0 +1,58 @@
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

@@ -0,0 +1,49 @@
module biz
import base
import freeflowuniverse.herolib.data.ourtime
import freeflowuniverse.herolib.data.currency
// import freeflowuniverse.herolib.core.texttools { name_fix }
// ProductType represents the type of a product
pub enum ProductType {
product
service
}
// ProductStatus represents the status of a product
pub enum ProductStatus {
available
unavailable
}
// ProductComponent represents a component of a product
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
pub struct Product {
base.Base // Base struct for common fields
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
}

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
}

View File

@@ -0,0 +1,27 @@
module biz
import base
import freeflowuniverse.herolib.data.ourtime
// ShareholderType represents the type of shareholder
pub enum ShareholderType {
individual
corporate
}
// Shareholder represents a shareholder of a company
pub struct Shareholder {
base.Base // Base struct for common fields
pub mut:
id u32
company_id u32
user_id u32
name string
shares f64
percentage f64
type_ ShareholderType
since ourtime.OurTime
created_at ourtime.OurTime
updated_at ourtime.OurTime
}

19
specs/models/biz/user.v Normal file
View File

@@ -0,0 +1,19 @@
module biz
import base
import freeflowuniverse.herolib.data.ourtime
// User represents a user in the Freezone Manager system
pub struct User {
base.Base // Base struct for common fields
pub mut:
id u32
name string
email string
password string
company string // here its just a best effort
role string
created_at ourtime.OurTime
updated_at ourtime.OurTime
}

51
specs/models/biz/vote.v Normal file
View File

@@ -0,0 +1,51 @@
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
}