github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/server/vote/types.go (about)

     1  package vote
     2  
     3  import (
     4  	"time"
     5  
     6  	rd "github.com/benoitkugler/goACVE/server/core/rawdata"
     7  )
     8  
     9  type Participation struct {
    10  	Total   int       `json:"total"`
    11  	Actuels int       `json:"actuels"`
    12  	Last    time.Time `json:"last"`
    13  }
    14  
    15  type Membre struct {
    16  	NomPrenom     string        `json:"nom_prenom"`
    17  	Mail          rd.String     `json:"mail"`
    18  	Lien          string        `json:"lien"`
    19  	Participation Participation `json:"participation"`
    20  }
    21  
    22  type VoteCandidats struct {
    23  	Vote
    24  
    25  	Candidats []Candidat `json:"candidats"`
    26  }
    27  
    28  type VoteAdmin struct {
    29  	VoteCandidats
    30  
    31  	Participation int           `json:"participation"` // nombre de vote effectués
    32  	Voix          map[int64]int `json:"voix"`          // id candidat -> suffrages
    33  }
    34  
    35  type LockVote struct {
    36  	IdVote   int64 `json:"id_vote,omitempty"`
    37  	IsLocked bool  `json:"is_locked,omitempty"`
    38  }
    39  
    40  type MetaPersonne struct {
    41  	PrenomNom string `json:"prenom_nom,omitempty"`
    42  }
    43  
    44  // VotePersonneComplet résume les choix possibles et
    45  // les choix actuels
    46  type VotePersonneComplet struct {
    47  	VoteCandidats
    48  
    49  	Time  time.Time `json:"time"`  // zero pour aucun note
    50  	Choix Ids       `json:"choix"` // candidats choisis
    51  }