Insert election with uuid instead of auto-generated id
This commit is contained in:
@ -145,7 +145,7 @@ func (r *createVotesRequestWithValidator) isValid() bool {
|
||||
return r.Valid()
|
||||
}
|
||||
|
||||
func (app *application) CreateVotes(w http.ResponseWriter, r *http.Request, id int) {
|
||||
func (app *application) CreateVotes(w http.ResponseWriter, r *http.Request, id string) {
|
||||
var request createVotesRequestWithValidator
|
||||
|
||||
if err := app.unmarshalRequest(r, &request); err != nil {
|
||||
@ -284,7 +284,7 @@ func (app *application) createVotesHandleUnknownVotersElection(w http.ResponseWr
|
||||
return voterIdentity, nil
|
||||
}
|
||||
|
||||
func (app *application) GetElectionResults(w http.ResponseWriter, r *http.Request, id int) {
|
||||
func (app *application) GetElectionResults(w http.ResponseWriter, r *http.Request, id string) {
|
||||
votes, err := app.votes.GetByElection(id)
|
||||
if err != nil {
|
||||
if errors.Is(sql.ErrNoRows, err) {
|
||||
@ -325,7 +325,7 @@ func getResultsFromVotes(votes *[]models.Vote) []api.VotesForChoice {
|
||||
return results
|
||||
}
|
||||
|
||||
func (app *application) GetElection(w http.ResponseWriter, r *http.Request, id int) {
|
||||
func (app *application) GetElection(w http.ResponseWriter, r *http.Request, id string) {
|
||||
election, err := app.elections.GetById(id)
|
||||
if err != nil {
|
||||
if errors.Is(sql.ErrNoRows, err) {
|
||||
|
Reference in New Issue
Block a user