Add some more tests and implement getElection
This commit is contained in:
19
internal/mappers/elections.go
Normal file
19
internal/mappers/elections.go
Normal file
@ -0,0 +1,19 @@
|
||||
package mappers
|
||||
|
||||
import (
|
||||
api "code.dlmw.ch/dlmw/qv/internal"
|
||||
"code.dlmw.ch/dlmw/qv/internal/models"
|
||||
)
|
||||
|
||||
func ElectionResponse(election *models.Election) *api.Election {
|
||||
return &api.Election{
|
||||
Id: election.ID,
|
||||
Name: election.Name,
|
||||
Tokens: election.Tokens,
|
||||
AreVotersKnown: election.AreVotersKnown,
|
||||
MaxVoters: election.MaxVoters,
|
||||
CreatedAt: election.CreatedAt.String(),
|
||||
ExpiresAt: election.ExpiresAt.String(),
|
||||
Choices: election.Choices,
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user