Insert election with uuid instead of auto-generated id
This commit is contained in:
@ -65,12 +65,12 @@ type mockElectionModel struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (e *mockElectionModel) Insert(name string, tokens int, areVotersKnown bool, maxVoters int, choices []string, expiresAt time.Time) (int, error) {
|
||||
func (e *mockElectionModel) Insert(name string, tokens int, areVotersKnown bool, maxVoters int, choices []string, expiresAt time.Time) (string, error) {
|
||||
args := e.Called(name, tokens, areVotersKnown, maxVoters, choices, expiresAt)
|
||||
return args.Int(0), args.Error(1)
|
||||
return args.String(0), args.Error(1)
|
||||
}
|
||||
|
||||
func (e *mockElectionModel) GetById(id int) (*models.Election, error) {
|
||||
func (e *mockElectionModel) GetById(id string) (*models.Election, error) {
|
||||
args := e.Called(id)
|
||||
return args.Get(0).(*models.Election), args.Error(1)
|
||||
}
|
||||
@ -79,17 +79,17 @@ type mockVoterModel struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (v *mockVoterModel) InsertMultiple(identities []string, electionID int) ([]int, error) {
|
||||
func (v *mockVoterModel) InsertMultiple(identities []string, electionID string) ([]int, error) {
|
||||
args := v.Called(identities, electionID)
|
||||
return args.Get(0).([]int), args.Error(1)
|
||||
}
|
||||
|
||||
func (v *mockVoterModel) CountByElection(electionID int) (int, error) {
|
||||
func (v *mockVoterModel) CountByElection(electionID string) (int, error) {
|
||||
args := v.Called(electionID)
|
||||
return args.Int(0), args.Error(1)
|
||||
}
|
||||
|
||||
func (v *mockVoterModel) Exists(voterIdentity string, electionID int) (bool, error) {
|
||||
func (v *mockVoterModel) Exists(voterIdentity string, electionID string) (bool, error) {
|
||||
args := v.Called(voterIdentity, electionID)
|
||||
return args.Bool(0), args.Error(1)
|
||||
}
|
||||
@ -98,17 +98,17 @@ type mockVoteModel struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (v *mockVoteModel) Insert(voterIdentity string, electionId int, choiceText string, tokens int) (int, error) {
|
||||
func (v *mockVoteModel) Insert(voterIdentity string, electionId string, choiceText string, tokens int) (int, error) {
|
||||
args := v.Called(voterIdentity, electionId, choiceText, tokens)
|
||||
return args.Int(0), args.Error(1)
|
||||
}
|
||||
|
||||
func (v *mockVoteModel) Exists(voterIdentity string, electionID int) (bool, error) {
|
||||
func (v *mockVoteModel) Exists(voterIdentity string, electionID string) (bool, error) {
|
||||
args := v.Called(voterIdentity, electionID)
|
||||
return args.Bool(0), args.Error(1)
|
||||
}
|
||||
|
||||
func (v *mockVoteModel) GetByElection(electionID int) (*[]models.Vote, error) {
|
||||
func (v *mockVoteModel) GetByElection(electionID string) (*[]models.Vote, error) {
|
||||
args := v.Called(electionID)
|
||||
return args.Get(0).(*[]models.Vote), args.Error(1)
|
||||
}
|
||||
|
Reference in New Issue
Block a user