[BREAKING] Ajouter response.Data pour GetHealth
Implémenter GetHealthResponse et GetHealthResponseData
This commit is contained in:
parent
fe1caec61e
commit
53c5d8f1c6
2 changed files with 20 additions and 5 deletions
|
@ -4,12 +4,16 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"git.agecem.com/agecem/bottin-agenda/data"
|
"git.agecem.com/agecem/bottin-agenda/data"
|
||||||
|
"git.agecem.com/agecem/bottin-agenda/responses"
|
||||||
bottindata "git.agecem.com/agecem/bottin/v5/data"
|
bottindata "git.agecem.com/agecem/bottin/v5/data"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetHealth(c echo.Context) error {
|
func GetHealth(c echo.Context) error {
|
||||||
|
var response responses.GetHealthResponse
|
||||||
|
var statusCode int = http.StatusNotImplemented
|
||||||
|
|
||||||
bottinApiKey := viper.GetString("bottin.api.key")
|
bottinApiKey := viper.GetString("bottin.api.key")
|
||||||
bottinApiHost := viper.GetString("bottin.api.host")
|
bottinApiHost := viper.GetString("bottin.api.host")
|
||||||
bottinApiProtocol := viper.GetString("bottin.api.protocol")
|
bottinApiProtocol := viper.GetString("bottin.api.protocol")
|
||||||
|
@ -48,9 +52,10 @@ func GetHealth(c echo.Context) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.JSON(http.StatusOK, map[string]string{
|
statusCode = http.StatusOK
|
||||||
"message": "Bottin-agenda API v2 is ready",
|
response.Message = "Bottin-agenda API v3 is ready"
|
||||||
"bottin": bottinStatus,
|
response.Data.Bottin = bottinStatus
|
||||||
"database": databaseStatus,
|
response.Data.Database = databaseStatus
|
||||||
})
|
|
||||||
|
return c.JSON(statusCode, response)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,16 @@ import (
|
||||||
"git.agecem.com/agecem/bottin-agenda/models"
|
"git.agecem.com/agecem/bottin-agenda/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type GetHealthResponseData struct {
|
||||||
|
Bottin string `json:"bottin"`
|
||||||
|
Database string `json:"database"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetHealthResponse struct {
|
||||||
|
Message string `json:"message"`
|
||||||
|
Data GetHealthResponseData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
type PostSeedResponse struct {
|
type PostSeedResponse struct {
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue