Skip to content
Snippets Groups Projects
Commit 3b3119d8 authored by Alexis POYEN's avatar Alexis POYEN
Browse files

Merge branch '19-unexport-handler-for-models' into 'master'

Refactor : don't export handlers in model except API handler

Closes #19

See merge request apoyen/elections!11
parents 143b320c 4eccefa8
1 merge request!11Refactor : don't export handlers in model except API handler
Pipeline #5439 passed
......@@ -9,7 +9,7 @@ import (
"forge.grandlyon.com/apoyen/elections/internal/auth"
)
func (d *DataHandler) HandleArea(w http.ResponseWriter, r *http.Request) {
func (d *DataHandler) handleArea(w http.ResponseWriter, r *http.Request) {
id, _ := strconv.Atoi(strings.TrimPrefix(r.URL.Path, "/api/Area/"))
switch method := r.Method; method {
case "GET":
......
......@@ -10,8 +10,8 @@ import (
"forge.grandlyon.com/apoyen/elections/internal/auth"
)
// HandleCapturer handle API calls on Capturer
func (d *DataHandler) HandleCapturer(w http.ResponseWriter, r *http.Request) {
// handleCapturer handle API calls on Capturer
func (d *DataHandler) handleCapturer(w http.ResponseWriter, r *http.Request) {
id, _ := strconv.Atoi(strings.TrimPrefix(r.URL.Path, "/api/Capturer/"))
switch method := r.Method; method {
case "GET":
......
......@@ -9,7 +9,7 @@ import (
"forge.grandlyon.com/apoyen/elections/internal/auth"
)
func (d *DataHandler) HandleDesk(w http.ResponseWriter, r *http.Request) {
func (d *DataHandler) handleDesk(w http.ResponseWriter, r *http.Request) {
id, _ := strconv.Atoi(strings.TrimPrefix(r.URL.Path, "/api/Desk/"))
switch method := r.Method; method {
case "GET":
......
......@@ -9,7 +9,7 @@ import (
"forge.grandlyon.com/apoyen/elections/internal/auth"
)
func (d *DataHandler) HandleElection(w http.ResponseWriter, r *http.Request) {
func (d *DataHandler) handleElection(w http.ResponseWriter, r *http.Request) {
id, _ := strconv.Atoi(strings.TrimPrefix(r.URL.Path, "/api/Election/"))
switch method := r.Method; method {
case "GET":
......
......@@ -217,15 +217,15 @@ func (d *DataHandler) ProcessAPI(w http.ResponseWriter, r *http.Request) {
api := strings.Split(strings.TrimPrefix(r.URL.Path, "/api/"), "/")[0]
switch api {
case "Capturer":
d.HandleCapturer(w, r)
d.handleCapturer(w, r)
case "Election":
d.HandleElection(w, r)
d.handleElection(w, r)
case "Area":
d.HandleArea(w, r)
d.handleArea(w, r)
case "Section":
d.HandleSection(w, r)
d.handleSection(w, r)
case "Desk":
d.HandleDesk(w, r)
d.handleDesk(w, r)
}
}
......
......@@ -9,7 +9,7 @@ import (
"forge.grandlyon.com/apoyen/elections/internal/auth"
)
func (d *DataHandler) HandleSection(w http.ResponseWriter, r *http.Request) {
func (d *DataHandler) handleSection(w http.ResponseWriter, r *http.Request) {
id, _ := strconv.Atoi(strings.TrimPrefix(r.URL.Path, "/api/Section/"))
switch method := r.Method; method {
case "GET":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment