chores!: bump API et go mod à v6
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`
This commit is contained in:
parent
fe50cb7335
commit
a8dcdd0388
12 changed files with 29 additions and 29 deletions
18
cmd/api.go
18
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
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
|||
module git.agecem.com/agecem/bottin/v5
|
||||
module git.agecem.com/agecem/bottin/v6
|
||||
|
||||
go 1.21.1
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
2
main.go
2
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()
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
Reference in a new issue