model spec
This commit is contained in:
51
specs/models/biz/vote.v
Normal file
51
specs/models/biz/vote.v
Normal 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
|
||||
}
|
Reference in New Issue
Block a user