52 lines
1.0 KiB
V
52 lines
1.0 KiB
V
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
|
|
}
|