From a8dcdd03886065637e8788c01ec549ac7a9913ff Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 5 Jan 2024 14:38:48 -0500 Subject: [PATCH] =?UTF-8?q?chores!:=20bump=20API=20et=20go=20mod=20=C3=A0?= =?UTF-8?q?=20v6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tag v6.0.0 est sorti mais n'était pas réflété dans le code. BREAKING: API est maintenant exposé sur `/v6` et non `/v5` --- cmd/api.go | 18 +++++++++--------- cmd/web.go | 6 +++--- data/apiclient.go | 10 +++++----- data/data.go | 2 +- go.mod | 2 +- handlers/handlers.go | 2 +- handlers/health.go | 6 +++--- handlers/insert.go | 4 ++-- handlers/read.go | 2 +- main.go | 2 +- responses/list.go | 2 +- web/webhandlers/handlers.go | 2 +- 12 files changed, 29 insertions(+), 29 deletions(-) diff --git a/cmd/api.go b/cmd/api.go index fb355be..b03be9a 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -6,8 +6,8 @@ import ( "log" "codeberg.org/vlbeaudoin/serpents" - "git.agecem.com/agecem/bottin/v5/data" - "git.agecem.com/agecem/bottin/v5/handlers" + "git.agecem.com/agecem/bottin/v6/data" + "git.agecem.com/agecem/bottin/v6/handlers" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" "github.com/spf13/cobra" @@ -62,19 +62,19 @@ var apiCmd = &cobra.Command{ // Routes - e.GET("/v5/health/", h.GetHealth) + e.GET("/v6/health/", h.GetHealth) - e.POST("/v5/membres/", h.PostMembres) + e.POST("/v6/membres/", h.PostMembres) - e.GET("/v5/membres/", h.ListMembres) + e.GET("/v6/membres/", h.ListMembres) - e.GET("/v5/membres/:membre_id/", h.ReadMembre) + e.GET("/v6/membres/:membre_id/", h.ReadMembre) - e.PUT("/v5/membres/:membre_id/prefered_name/", h.PutMembrePreferedName) + e.PUT("/v6/membres/:membre_id/prefered_name/", h.PutMembrePreferedName) - e.POST("/v5/programmes/", h.PostProgrammes) + e.POST("/v6/programmes/", h.PostProgrammes) - e.POST("/v5/seed/", h.PostSeed) + e.POST("/v6/seed/", h.PostSeed) // Execution diff --git a/cmd/web.go b/cmd/web.go index 1aa9e31..4d1a556 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -10,9 +10,9 @@ import ( "net/http" "codeberg.org/vlbeaudoin/serpents" - "git.agecem.com/agecem/bottin/v5/data" - "git.agecem.com/agecem/bottin/v5/web" - "git.agecem.com/agecem/bottin/v5/web/webhandlers" + "git.agecem.com/agecem/bottin/v6/data" + "git.agecem.com/agecem/bottin/v6/web" + "git.agecem.com/agecem/bottin/v6/web/webhandlers" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" "github.com/spf13/cobra" diff --git a/data/apiclient.go b/data/apiclient.go index d5257cf..a068809 100644 --- a/data/apiclient.go +++ b/data/apiclient.go @@ -6,8 +6,8 @@ import ( "net/http" "codeberg.org/vlbeaudoin/voki" - "git.agecem.com/agecem/bottin/v5/models" - "git.agecem.com/agecem/bottin/v5/responses" + "git.agecem.com/agecem/bottin/v6/models" + "git.agecem.com/agecem/bottin/v6/responses" "github.com/spf13/viper" ) @@ -33,7 +33,7 @@ func NewApiClient(client *http.Client, key, host, protocol string, port int) *Ap // GetHealth allows checking for API server health func (a *ApiClient) GetHealth() (string, error) { var getHealthResponse responses.GetHealthResponse - err := a.Voki.Unmarshal(http.MethodGet, "/v5/health", nil, true, &getHealthResponse) + err := a.Voki.Unmarshal(http.MethodGet, "/v6/health", nil, true, &getHealthResponse) if err != nil { return getHealthResponse.Message, err } @@ -57,7 +57,7 @@ func (a *ApiClient) GetMembre(membreID string) (models.Membre, error) { return getMembreResponse.Data.Membre, errors.New("Veuillez fournir un numéro étudiant à rechercher") } - err := a.Voki.Unmarshal(http.MethodGet, fmt.Sprintf("/v5/membres/%s", membreID), nil, true, &getMembreResponse) + err := a.Voki.Unmarshal(http.MethodGet, fmt.Sprintf("/v6/membres/%s", membreID), nil, true, &getMembreResponse) if err != nil { return getMembreResponse.Data.Membre, err } @@ -70,5 +70,5 @@ func (a *ApiClient) GetMembre(membreID string) (models.Membre, error) { } func (a *ApiClient) ListMembres() (r responses.ListMembresResponse, err error) { - return r, a.Voki.Unmarshal(http.MethodGet, "/v5/membres", nil, true, &r) + return r, a.Voki.Unmarshal(http.MethodGet, "/v6/membres", nil, true, &r) } diff --git a/data/data.go b/data/data.go index 98c293b..c4cc026 100644 --- a/data/data.go +++ b/data/data.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - "git.agecem.com/agecem/bottin/v5/models" + "git.agecem.com/agecem/bottin/v6/models" _ "github.com/jackc/pgx/stdlib" "github.com/jmoiron/sqlx" "github.com/spf13/viper" diff --git a/go.mod b/go.mod index 55c8485..014c923 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module git.agecem.com/agecem/bottin/v5 +module git.agecem.com/agecem/bottin/v6 go 1.21.1 diff --git a/handlers/handlers.go b/handlers/handlers.go index 7bbb88f..0b35b23 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -1,6 +1,6 @@ package handlers -import "git.agecem.com/agecem/bottin/v5/data" +import "git.agecem.com/agecem/bottin/v6/data" type Handler struct { DataClient *data.DataClient diff --git a/handlers/health.go b/handlers/health.go index 9e58673..4923493 100644 --- a/handlers/health.go +++ b/handlers/health.go @@ -3,8 +3,8 @@ package handlers import ( "net/http" - "git.agecem.com/agecem/bottin/v5/data" - "git.agecem.com/agecem/bottin/v5/responses" + "git.agecem.com/agecem/bottin/v6/data" + "git.agecem.com/agecem/bottin/v6/responses" "github.com/labstack/echo/v4" ) @@ -30,7 +30,7 @@ func (h *Handler) GetHealth(c echo.Context) error { } response.StatusCode = http.StatusOK - response.Message = "Bottin API v5 is ready" + response.Message = "Bottin API v6 is ready" return c.JSON(response.StatusCode, response) } diff --git a/handlers/insert.go b/handlers/insert.go index 9a1c79b..c4654b9 100644 --- a/handlers/insert.go +++ b/handlers/insert.go @@ -5,8 +5,8 @@ import ( "io" "net/http" - "git.agecem.com/agecem/bottin/v5/models" - "git.agecem.com/agecem/bottin/v5/responses" + "git.agecem.com/agecem/bottin/v6/models" + "git.agecem.com/agecem/bottin/v6/responses" "github.com/labstack/echo/v4" "github.com/gocarina/gocsv" diff --git a/handlers/read.go b/handlers/read.go index 8fec2b1..0a5b1fd 100644 --- a/handlers/read.go +++ b/handlers/read.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "git.agecem.com/agecem/bottin/v5/responses" + "git.agecem.com/agecem/bottin/v6/responses" "github.com/labstack/echo/v4" ) diff --git a/main.go b/main.go index 567ba46..f0b7d52 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,6 @@ package main -import "git.agecem.com/agecem/bottin/v5/cmd" +import "git.agecem.com/agecem/bottin/v6/cmd" func main() { cmd.Execute() diff --git a/responses/list.go b/responses/list.go index 04df99f..4783e90 100644 --- a/responses/list.go +++ b/responses/list.go @@ -2,7 +2,7 @@ package responses import ( "codeberg.org/vlbeaudoin/voki/response" - "git.agecem.com/agecem/bottin/v5/models" + "git.agecem.com/agecem/bottin/v6/models" ) type ListMembresResponse struct { diff --git a/web/webhandlers/handlers.go b/web/webhandlers/handlers.go index 96fba50..348e43a 100644 --- a/web/webhandlers/handlers.go +++ b/web/webhandlers/handlers.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "git.agecem.com/agecem/bottin/v5/data" + "git.agecem.com/agecem/bottin/v6/data" "github.com/labstack/echo/v4" ) -- 2.45.2