[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"
|
||||
|
||||
"git.agecem.com/agecem/bottin-agenda/data"
|
||||
"git.agecem.com/agecem/bottin-agenda/responses"
|
||||
bottindata "git.agecem.com/agecem/bottin/v5/data"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func GetHealth(c echo.Context) error {
|
||||
var response responses.GetHealthResponse
|
||||
var statusCode int = http.StatusNotImplemented
|
||||
|
||||
bottinApiKey := viper.GetString("bottin.api.key")
|
||||
bottinApiHost := viper.GetString("bottin.api.host")
|
||||
bottinApiProtocol := viper.GetString("bottin.api.protocol")
|
||||
|
@ -48,9 +52,10 @@ func GetHealth(c echo.Context) error {
|
|||
}
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, map[string]string{
|
||||
"message": "Bottin-agenda API v2 is ready",
|
||||
"bottin": bottinStatus,
|
||||
"database": databaseStatus,
|
||||
})
|
||||
statusCode = http.StatusOK
|
||||
response.Message = "Bottin-agenda API v3 is ready"
|
||||
response.Data.Bottin = bottinStatus
|
||||
response.Data.Database = databaseStatus
|
||||
|
||||
return c.JSON(statusCode, response)
|
||||
}
|
||||
|
|
|
@ -4,6 +4,16 @@ import (
|
|||
"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 {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue