Add operationId for election results
This commit is contained in:
@ -103,6 +103,7 @@ paths:
|
||||
tags:
|
||||
- election
|
||||
summary: Get the results of an election
|
||||
operationId: getElectionResults
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user