Ajouter décompte
This commit is contained in:
parent
7351f970f7
commit
6c09f1fa65
9 changed files with 126 additions and 1 deletions
|
@ -17,6 +17,7 @@ func DeclareRoutes(e *echo.Group, h *APIHandler) {
|
|||
e.GET("/health/", h.HealthGET)
|
||||
e.GET("/scan/:membre_id/", h.ScanGET)
|
||||
e.POST("/scan/:membre_id/", h.ScanPOST)
|
||||
e.GET("/decompte/", h.DecompteGET)
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -168,3 +169,26 @@ func (a *APIHandler) ScanPOST(c echo.Context) error {
|
|||
|
||||
return c.JSON(r.StatusCode, r)
|
||||
}
|
||||
|
||||
// DecompteGET is the handler for `GET /v:version/decompte/ http/1.1`
|
||||
func (a *APIHandler) DecompteGET(c echo.Context) error {
|
||||
var r apiresponse.DecompteGET
|
||||
|
||||
r.Message = "not ok"
|
||||
|
||||
decompte, err := a.DBClient.GetDecompte()
|
||||
if err != nil {
|
||||
r.Error = err.Error()
|
||||
r.StatusCode = http.StatusInternalServerError
|
||||
r.Message = "Error during a.DBClient.GetDecompte"
|
||||
|
||||
return c.JSON(r.StatusCode, r)
|
||||
}
|
||||
|
||||
r.Data.Decompte = decompte
|
||||
|
||||
r.StatusCode = http.StatusOK
|
||||
r.Message = "ok"
|
||||
|
||||
return c.JSON(r.StatusCode, r)
|
||||
}
|
||||
|
|
Reference in a new issue