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
}

View File

@ -0,0 +1,31 @@
module crm
import base
import freeflowuniverse.herolib.data.ourtime
// Account represents a business or organization.
// Enums like AccountType and AccountIndustry have been removed for broader applicability.
// Fields previously using these enums now use `string` type.
pub struct Account {
base.Base // Base struct for common fields
pub mut:
name string
typ string // Type of account (e.g., Customer, Partner) - formerly AccountType enum
industry string // Industry of the account (e.g., Technology, Healthcare) - formerly AccountIndustry enum
employees u32
annual_revenue f64
billing_street string
billing_city string
billing_state string
billing_postal_code string
billing_country string
shipping_street string
shipping_city string
shipping_state string
shipping_postal_code string
shipping_country string
description string
assigned_user_id u32 // Reference to User
created_by_id u32 // Reference to User
primary_contact_id u32? // Optional: Reference to Contact
}

39
specs/models/crm/call.v Normal file
View File

@ -0,0 +1,39 @@
module crm
import base
import freeflowuniverse.herolib.data.ourtime
// CallStatus represents the status of a call
pub enum CallStatus {
planned
held
not_held
canceled
}
// CallDirection represents the direction of a call
pub enum CallDirection {
outbound
inbound
}
// Call represents a phone call in the CRM system
pub struct Call {
base.Base // Base struct for common fields (id u32, creation_time, mod_time)
pub mut:
name string
status CallStatus
direction CallDirection
date_start ourtime.OurTime
duration u32 // Duration in minutes
description string
parent_type string // Can be 'Account', 'Contact', 'Lead', 'Opportunity', 'Case'
parent_id u32 // Reference to the parent entity
account_id u32 // Reference to Account
contact_id u32 // Reference to Contact
lead_id u32 // Reference to Lead
phone_number string
recording_url string // Optional
assigned_user_id u32 // Reference to User
created_by_id u32 // Reference to User
}

View File

@ -0,0 +1,57 @@
module crm
import base
import freeflowuniverse.herolib.data.ourtime
// CampaignStatus represents the status of a marketing campaign
pub enum CampaignStatus {
planning
active
inactive
complete
canceled
}
// CampaignType represents the type of a marketing campaign
pub enum CampaignType {
email
newsletter
web
television
radio
mail
print
social_media
telemarketing
event
other
}
// Campaign represents a marketing campaign in the CRM system
pub struct Campaign {
base.Base // Base struct for common fields (id u32, creation_time, mod_time)
pub mut:
name string
status CampaignStatus
type CampaignType
start_date ourtime.OurTime
end_date ourtime.OurTime
budget f64
expected_revenue f64
expected_cost f64
actual_cost f64
objective string
description string
target_audience string
sent_count u32
open_count u32
click_count u32
bounce_count u32
opt_out_count u32
lead_count u32
opportunity_count u32
revenue f64
roi f64 // Return on Investment
assigned_user_id u32 // Reference to User
created_by_id u32 // Reference to User
}

53
specs/models/crm/case.v Normal file
View File

@ -0,0 +1,53 @@
module crm
import base
import freeflowuniverse.herolib.data.ourtime
// CaseStatus represents the status of a support case
pub enum CaseStatus {
new
assigned
pending
closed
rejected
duplicate
}
// CasePriority represents the priority of a support case
pub enum CasePriority {
low
medium
high
urgent
}
// CaseType represents the type of a support case
pub enum CaseType {
question
incident
problem
feature_request
bug
}
// Case represents a customer support case in the CRM system
pub struct Case {
base.Base // Base struct for common fields (id u32, creation_time, mod_time)
pub mut:
// id u32 // Removed, provided by base.Base
number string // Auto-generated case number (e.g., "C-00001")
name string
status CaseStatus
priority CasePriority
type CaseType
account_id u32 // Reference to Account
contact_id u32 // Reference to Contact
description string
resolution string // Optional
solution string // Optional
resolved_at ourtime.OurTime // Optional
// created_at ourtime.OurTime // Removed, provided by base.Base.creation_time
// updated_at ourtime.OurTime // Removed, provided by base.Base.mod_time
assigned_user_id u32 // Reference to User
created_by_id u32 // Reference to User
}

View File

@ -0,0 +1,35 @@
module crm
import base
import freeflowuniverse.herolib.data.ourtime
// Contact represents an individual person in the CRM system.
pub struct Contact {
base.Base // Provides id u32, creation_time, mod_time
pub mut:
first_name string
last_name string
title string // e.g., Mr., Ms., Dr.
email string
phone string
mobile string
job_title string
department string // Optional
// company_id u32 // Optional: If directly linked to a primary company/account
// reports_to_id u32 // Optional: Contact ID of their manager
// Address fields
address_street string
address_city string
address_state string
address_postal_code string
address_country string
description string // General notes about the contact
do_not_call bool
email_opt_out bool
// Social media profiles could be added here too
// linkedin_profile string
// twitter_profile string
}

47
specs/models/crm/lead.v Normal file
View File

@ -0,0 +1,47 @@
module crm
import base
import freeflowuniverse.herolib.data.ourtime
// LeadStatus represents the status of a lead
pub enum LeadStatus {
new
assigned
in_process
converted
recycled
dead
}
// LeadSource represents the source of a lead
pub enum LeadSource {
website
call
email
existing_customer
partner
public_relations
campaign
conference
trade_show
word_of_mouth
other
}
// Lead represents a potential customer in the CRM system
pub struct Lead {
base.Base // Base struct for common fields (id u32, creation_time, mod_time)
pub mut:
// id u32 // Removed, provided by base.Base
contact_id u32 // Reference to a Contact (holds name, email, phone etc.)
description string
status LeadStatus
source LeadSource
opportunity_amount f64 // Optional: If lead is converted, this could be initial amount
opportunity_name string // Optional: If lead is converted, this could be initial name
converted_at ourtime.OurTime // Optional: Timestamp when lead was converted
// created_at ourtime.OurTime // Removed, provided by base.Base.creation_time
// updated_at ourtime.OurTime // Removed, provided by base.Base.mod_time
assigned_user_id u32 // Reference to User
created_by_id u32 // Reference to User
}

View File

@ -0,0 +1,57 @@
module crm
import base
import freeflowuniverse.herolib.data.ourtime
// Opportunity represents a potential sale in the CRM system
pub struct Opportunity {
base.Base // Base struct for common fields (id u32, creation_time, mod_time)
pub mut:
// id u32 // Removed, provided by base.Base
name string
account_id u32 // Reference to Account
amount f64
close_date ourtime.OurTime // Expected close date
probability f64 // Percentage (0-100)
stage OpportunityStage
source OpportunitySource
lead_source string // More specific lead source details if needed
campaign_id u32 // Optional: Reference to Campaign
description string
next_step string // Optional
competition string // Optional
// created_at ourtime.OurTime // Removed, provided by base.Base.creation_time
// updated_at ourtime.OurTime // Removed, provided by base.Base.mod_time
assigned_user_id u32 // Reference to User
created_by_id u32 // Reference to User
contacts []u32 // References to Contacts associated with this opportunity
}
// OpportunityStage represents the stage of an opportunity
pub enum OpportunityStage {
prospecting
qualification
needs_analysis
value_proposition
id_decision_makers
perception_analysis
proposal_price_quote
negotiation_review
closed_won
closed_lost
}
// OpportunitySource represents the source of an opportunity
pub enum OpportunitySource {
call
email
existing_customer
partner
public_relations
campaign
web_site
conference
trade_show
word_of_mouth
other
}

43
specs/models/crm/task.v Normal file
View File

@ -0,0 +1,43 @@
module crm
import base
import freeflowuniverse.herolib.data.ourtime
// TaskStatus represents the status of a task
pub enum TaskStatus {
not_started
in_progress
completed
deferred
canceled
}
// TaskPriority represents the priority of a task
pub enum TaskPriority {
low
medium
high
urgent
}
// Task represents a task or to-do item in the CRM system
pub struct Task {
base.Base // Base struct for common fields (id u32, creation_time, mod_time)
pub mut:
// id u32 // Removed, provided by base.Base
name string
status TaskStatus
priority TaskPriority
due_date ourtime.OurTime // Optional
completed_at ourtime.OurTime // Optional
description string
parent_type string // Optional: Can be 'Account', 'Contact', 'Lead', 'Opportunity', 'Case'
parent_id u32 // Optional: Reference to the parent entity
account_id u32 // Optional: Reference to Account
contact_id u32 // Optional: Reference to Contact
reminder_time ourtime.OurTime // Optional
// created_at ourtime.OurTime // Removed, provided by base.Base.creation_time
// updated_at ourtime.OurTime // Removed, provided by base.Base.mod_time
assigned_user_id u32 // Reference to User
created_by_id u32 // Reference to User
}

View File

@ -0,0 +1,61 @@
module marketplace
import base
import freeflowuniverse.herolib.data.ourtime
import asset // For AssetType
// ListingStatus, ListingType enums and Bid struct are used from the same module
// Listing represents a marketplace listing for an asset
pub struct Listing {
base.Base // Provides id, created_at, updated_at
pub mut:
title string
description string
asset_id string
asset_type asset.AssetType // Enum from the asset model
seller_id string
price f64 // Initial price for fixed price, or starting price for auction
currency string
listing_type ListingType
status ListingStatus
expires_at ourtime.OurTime // Optional
sold_at ourtime.OurTime // Optional
buyer_id string // Optional
sale_price f64 // Optional
bids []Bid // List of bids for auction type listings
tags []string
image_url string // Optional
}
// ListingStatus defines the status of a marketplace listing
pub enum ListingStatus {
active
sold
cancelled
expired
}
// ListingType defines the type of marketplace listing
pub enum ListingType {
fixed_price
auction
exchange
}
// Bid represents a bid on an auction listing
pub struct Bid {
pub mut:
listing_id string // ID of the listing this bid belongs to
bidder_id u32
amount f64
currency string
status BidStatus
}
// BidStatus defines the status of a bid on an auction listing
pub enum BidStatus {
active
accepted
rejected
cancelled
}

59
specs/models/flow/flow.v Normal file
View File

@ -0,0 +1,59 @@
module flow
import base
import freeflowuniverse.herolib.data.ourtime
// enums from flow_enums.v and FlowStep from flow_step.v are used as they are in the same module
// Flow represents a complete workflow with multiple steps
pub struct Flow {
base.Base // For common fields like id, created_at, updated_at
pub mut:
name string
description string
flow_type string
status FlowStatus
current_step_id string // Optional: Based on Option<FlowStep> in Rust, storing just ID
progress_percentage u8
owner_id string
owner_name string
data string // Serialized JSON data (jsonb in Rust)
steps []FlowStep
// current_step is not directly mapped, as it's derived. current_step_id can be used.
}
// FlowStatus defines the overall status of a flow
pub enum FlowStatus {
in_progress
completed
stuck
cancelled
}
// FlowStep represents an individual step within a larger flow
pub struct FlowStep {
pub mut:
id string // UUID, from Uuid::new_v4().to_string()
name string
description string
status StepStatus
order u32
started_at ourtime.OurTime // Optional: Option<DateTime<Utc>>
completed_at ourtime.OurTime // Optional: Option<DateTime<Utc>>
logs []FlowLog
}
// StepStatus defines the status of an individual step within a flow
pub enum StepStatus {
pending
in_progress
completed
stuck
skipped
}
// FlowLog represents a log entry within a flow step
pub struct FlowLog {
pub mut:
timestamp ourtime.OurTime
message string
}

View File

@ -0,0 +1,62 @@
module governance
import base
import freeflowuniverse.herolib.data.ourtime
// ProposalStatus enum is used from governance_enums.v in the same module
// Proposal represents a governance proposal that can be voted upon.
// It now incorporates the voting mechanism from biz/vote.v.
pub struct Proposal {
base.Base // Provides Proposal's own ID, created_at, updated_at
pub mut:
// Fields from original Proposal struct
creator_id string // User ID of the proposal creator
title string // Title of the proposal
description string // Detailed description of the proposal
status ProposalStatus // Status of the proposal lifecycle (draft, active, approved etc.)
// Fields from biz/vote.v's Vote struct (representing the voting event aspects of the proposal)
vote_start_date ourtime.OurTime // When voting on this proposal starts
vote_end_date ourtime.OurTime // When voting on this proposal ends
vote_status VoteEventStatus // Status of the voting event (open, closed, cancelled)
options []VoteOption // The choices users can vote for
ballots []Ballot // The cast votes by users
private_group []u32 // Optional: list of user IDs who are eligible to vote
}
// ProposalStatus defines the lifecycle status of a governance proposal itself
pub enum ProposalStatus {
draft // Proposal is being prepared
active // Proposal is active (might be pre-voting, during voting, or post-voting but not yet finalized)
approved // Proposal has been formally approved
rejected // Proposal has been formally rejected
cancelled// Proposal was cancelled
}
// -- Structures from biz/vote.v, adapted for integration --
// VoteEventStatus represents the status of the voting process for a proposal
// Renamed from VoteStatus in biz/vote.v to avoid confusion with ProposalStatus
pub enum VoteEventStatus {
open // Voting is currently open
closed // Voting has finished
cancelled // The voting event was cancelled
}
// VoteOption represents a specific choice that can be voted on within a proposal's voting event
pub struct VoteOption {
pub mut:
id u8 // Simple identifier for this option within this proposal's vote (e.g., 1, 2, 3)
text string // The descriptive text of the option (e.g., "Option A: Approve budget")
count int // How many votes this option has received
min_valid int // Optional: minimum votes needed for this option to be considered valid
}
// Ballot represents an individual vote cast by a user for a specific proposal
pub struct Ballot {
base.Base // Provides Ballot's own ID, created_at, updated_at
pub mut:
user_id u32 // The ID of the user who cast this ballot
vote_option_id u8 // The 'id' of the VoteOption chosen by the user
shares_count int // Number of shares/tokens/voting power used for this ballot
}

View File

@ -0,0 +1,66 @@
module contract
import base
import freeflowuniverse.herolib.data.ourtime
// Contract represents a legal agreement
pub struct Contract {
base.Base // Base struct for common fields
pub mut:
id string // Unique ID for the contract (UUID string)
title string
description string
contract_type string // service, employment, nda, sla, partnership, distribution, license, membership, other
status ContractStatus
created_at ourtime.OurTime
updated_at ourtime.OurTime
created_by string // User ID or name of the creator
terms_and_conditions string // JSON string or markdown
start_date ourtime.OurTime // Optional
end_date ourtime.OurTime // Optional
renewal_period_days int // Optional (0 if not applicable)
next_renewal_date ourtime.OurTime // Optional
signers []ContractSigner
revisions []ContractRevision
current_version u32
last_signed_date ourtime.OurTime // Optional
}
// ContractRevision represents a version of the contract content
pub struct ContractRevision {
// base.Base // If applicable
pub mut:
version u32
content string // The actual content of the contract revision
created_at ourtime.OurTime
created_by string // User ID or name of the creator
comments string // Optional in Rust, string can be empty
}
// ContractStatus defines the possible statuses of a contract
pub enum ContractStatus {
draft
pending_signatures
signed
active
expired
cancelled
}
// ContractSigner represents a party involved in signing a contract
pub struct ContractSigner {
pub mut:
id string // Unique ID for the signer (UUID string)
name string
email string
status SignerStatus
signed_at ourtime.OurTime // Optional in Rust, OurTime can be zero
comments string // Optional in Rust, string can be empty
}
// SignerStatus defines the status of a contract signer
pub enum SignerStatus {
pending
signed
rejected
}

View File

@ -10,20 +10,6 @@ pub enum EventStatus {
tentative
}
// EventColor represents the color categorization of a calendar event
pub enum EventColor {
red
blue
green
yellow
purple
orange
cyan
magenta
gray
custom // For custom color values
}
// EventVisibility represents the visibility setting of a calendar event
pub enum EventVisibility {
public
@ -41,7 +27,7 @@ pub enum AttendeeResponse {
// Calendar represents a collection of events
pub struct Calendar {
base.Base
base.Base // Provides id u32, creation_time, mod_time, comments []u32
pub mut:
name string // Name of the calendar
description string // Description of the calendar
@ -74,7 +60,6 @@ pub mut:
attendees []Attendee // List of attendees
organizer u32 // The user (see circle) who created the event
status EventStatus // Status of the event
color EventColor // User-friendly color categorization
reminders []Reminder // Reminders for this event
timezone string // Timezone for this specific event
visibility EventVisibility // Visibility setting for the event

View File

@ -37,7 +37,7 @@ pub enum SocialPlatformType {
// Contact represents a contact with all their information
pub struct Contact {
base.Base
base.Base // Provides id u32, creation_time, mod_time, comments []u32
pub mut:
name string // Display name of the contact
first_name string
@ -101,7 +101,7 @@ pub mut:
// ContactGroup represents a group of contacts
pub struct ContactGroup {
base.Base
base.Base // Provides id u32, creation_time, mod_time, comments []u32
pub mut:
name string
description string

View File

@ -12,29 +12,29 @@ pub enum MessagePriority {
// Message represents an email message that can be used for email as well as chat
pub struct Message {
base.Base // Base struct for common fields
base.Base // Provides id u32, creation_time, mod_time, comments []u32
pub mut:
// Database ID
conversation_id string // ID for grouping messages in the same thread
folder string // The folder this email belongs to (inbox, sent, drafts, etc.)
labels []u16 //from circle config called message (config with name message)
conversation_id string // Grouping ID for messages in the same thread (not an entity foreign key)
folder string // The folder this email belongs to (e.g., inbox, sent, drafts)
labels []u16 // Numeric label codes, defined in 'message' circle configuration
message string // The email body content
attachments []u32// Any file attachment, is in circle
attachments []u32 // List of Attachment.id references, stored in circle
send_time ourtime.OurTime
scheduled_send ourtime.OurTime // Time to send if scheduled
size u32 // Size of the message in bytes
read bool // Whether the email has been read
flagged bool // Whether the email has been flagged/starred
priority MessagePriority // Priority level
size u32 // Size of the message in bytes
read bool // Whether the email has been read
flagged bool // Whether the email has been flagged/starred
priority MessagePriority // Priority level
// Header information
subject string
from []u32 // List of user IDs (or email addresses) who sent the email user needs to exist in circle where we use this
sender []u32
reply_to []u32
to []u32
cc []u32
bcc []u32
in_reply_to u32
draft bool // Whether this is a draft message
from []u32 // List of User.id's who authored the message
sender []u32 // List of User.id's who sent the message (if different from 'from')
reply_to []u32 // List of User.id's to reply to
to []u32 // List of User.id's of primary recipients
cc []u32 // List of User.id's of CC recipients
bcc []u32 // List of User.id's of BCC recipients
in_reply_to_message_id u32? // Optional: Message.id of the message this is a reply to
draft bool // Whether this is a draft message
}

View File

@ -0,0 +1,17 @@
module ticket
import base
import freeflowuniverse.herolib.data.ourtime
// TicketStatus and TicketPriority enums are used from ticket_enums.v in the same module
// Ticket represents a support ticket in the system
pub struct Ticket {
base.Base // Provides id u32, creation_time, mod_time, comments []u32
pub mut:
user_id u32 // Reference to User.id (the user who created the ticket)
title string
description string
status TicketStatus
priority TicketPriority
assigned_to_user_id u32? // Optional: Reference to User.id (the user assigned to the ticket)
}

View File

@ -0,0 +1,14 @@
module ticket
import base
import freeflowuniverse.herolib.data.ourtime
// TicketComment represents a comment on a support ticket
pub struct TicketComment {
base.Base // Provides id u32, creation_time, mod_time, comments []u32
pub mut:
ticket_id u32 // Reference to Ticket.id
user_id u32 // Reference to User.id (author of the comment)
content string
is_support_response bool // True if the comment is from a support agent
}

View File

@ -0,0 +1,18 @@
module ticket
// TicketStatus defines the status of a support ticket
pub enum TicketStatus {
open
in_progress
waiting_for_customer
resolved
closed
}
// TicketPriority defines the priority of a support ticket
pub enum TicketPriority {
low
medium
high
critical
}

20
specs/models/user.v Normal file
View File

@ -0,0 +1,20 @@
module user
import base
import freeflowuniverse.herolib.data.ourtime
// UserRole represents the possible roles a user can have
pub enum UserRole {
user
admin
}
// User represents a user in the system
pub struct User {
base.Base // Base struct for common fields (id u32, creation_time, mod_time, comments []u32)
pub mut:
name string
email string
password_hash string // Hashed password
role UserRole
}