Add operationId for election results

This commit is contained in:
2025-01-13 10:59:05 +01:00
parent 4f50aca3b6
commit c3563878b7
2 changed files with 6 additions and 5 deletions

View File

@ -69,7 +69,7 @@ type ServerInterface interface {
CreateElection(w http.ResponseWriter, r *http.Request)
// Get the results of an election
// (GET /election/{id}/results)
GetElectionIdResults(w http.ResponseWriter, r *http.Request, id int)
GetElectionResults(w http.ResponseWriter, r *http.Request, id int)
// Cast your votes for an election
// (POST /election/{id}/votes)
CreateVotes(w http.ResponseWriter, r *http.Request, id int)
@ -99,8 +99,8 @@ func (siw *ServerInterfaceWrapper) CreateElection(w http.ResponseWriter, r *http
handler.ServeHTTP(w, r.WithContext(ctx))
}
// GetElectionIdResults operation middleware
func (siw *ServerInterfaceWrapper) GetElectionIdResults(w http.ResponseWriter, r *http.Request) {
// GetElectionResults operation middleware
func (siw *ServerInterfaceWrapper) GetElectionResults(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
var err error
@ -115,7 +115,7 @@ func (siw *ServerInterfaceWrapper) GetElectionIdResults(w http.ResponseWriter, r
}
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
siw.Handler.GetElectionIdResults(w, r, id)
siw.Handler.GetElectionResults(w, r, id)
}))
for _, middleware := range siw.HandlerMiddlewares {
@ -266,7 +266,7 @@ func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.H
}
m.HandleFunc("POST "+options.BaseURL+"/election", wrapper.CreateElection)
m.HandleFunc("GET "+options.BaseURL+"/election/{id}/results", wrapper.GetElectionIdResults)
m.HandleFunc("GET "+options.BaseURL+"/election/{id}/results", wrapper.GetElectionResults)
m.HandleFunc("POST "+options.BaseURL+"/election/{id}/votes", wrapper.CreateVotes)
return m