Add operationId for election results
This commit is contained in:
@ -103,6 +103,7 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- election
|
- election
|
||||||
summary: Get the results of an election
|
summary: Get the results of an election
|
||||||
|
operationId: getElectionResults
|
||||||
parameters:
|
parameters:
|
||||||
- name: id
|
- name: id
|
||||||
in: path
|
in: path
|
||||||
|
@ -69,7 +69,7 @@ type ServerInterface interface {
|
|||||||
CreateElection(w http.ResponseWriter, r *http.Request)
|
CreateElection(w http.ResponseWriter, r *http.Request)
|
||||||
// Get the results of an election
|
// Get the results of an election
|
||||||
// (GET /election/{id}/results)
|
// (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
|
// Cast your votes for an election
|
||||||
// (POST /election/{id}/votes)
|
// (POST /election/{id}/votes)
|
||||||
CreateVotes(w http.ResponseWriter, r *http.Request, id int)
|
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))
|
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetElectionIdResults operation middleware
|
// GetElectionResults operation middleware
|
||||||
func (siw *ServerInterfaceWrapper) GetElectionIdResults(w http.ResponseWriter, r *http.Request) {
|
func (siw *ServerInterfaceWrapper) GetElectionResults(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
|
|
||||||
var err error
|
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) {
|
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 {
|
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("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)
|
m.HandleFunc("POST "+options.BaseURL+"/election/{id}/votes", wrapper.CreateVotes)
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
Reference in New Issue
Block a user