Merge pull request 'Bump API et go mod à v6' (#43) from chores/bump-api-v6 into main

Reviewed-on: #43
This commit is contained in:
Victor Lacasse-Beaudoin 2024-01-05 14:48:13 -05:00
commit 6ee96c3b97
12 changed files with 29 additions and 29 deletions

View file

@ -6,8 +6,8 @@ import (
"log" "log"
"codeberg.org/vlbeaudoin/serpents" "codeberg.org/vlbeaudoin/serpents"
"git.agecem.com/agecem/bottin/v5/data" "git.agecem.com/agecem/bottin/v6/data"
"git.agecem.com/agecem/bottin/v5/handlers" "git.agecem.com/agecem/bottin/v6/handlers"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware" "github.com/labstack/echo/v4/middleware"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -62,19 +62,19 @@ var apiCmd = &cobra.Command{
// Routes // 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 // Execution

View file

@ -10,9 +10,9 @@ import (
"net/http" "net/http"
"codeberg.org/vlbeaudoin/serpents" "codeberg.org/vlbeaudoin/serpents"
"git.agecem.com/agecem/bottin/v5/data" "git.agecem.com/agecem/bottin/v6/data"
"git.agecem.com/agecem/bottin/v5/web" "git.agecem.com/agecem/bottin/v6/web"
"git.agecem.com/agecem/bottin/v5/web/webhandlers" "git.agecem.com/agecem/bottin/v6/web/webhandlers"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware" "github.com/labstack/echo/v4/middleware"
"github.com/spf13/cobra" "github.com/spf13/cobra"

View file

@ -6,8 +6,8 @@ import (
"net/http" "net/http"
"codeberg.org/vlbeaudoin/voki" "codeberg.org/vlbeaudoin/voki"
"git.agecem.com/agecem/bottin/v5/models" "git.agecem.com/agecem/bottin/v6/models"
"git.agecem.com/agecem/bottin/v5/responses" "git.agecem.com/agecem/bottin/v6/responses"
"github.com/spf13/viper" "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 // GetHealth allows checking for API server health
func (a *ApiClient) GetHealth() (string, error) { func (a *ApiClient) GetHealth() (string, error) {
var getHealthResponse responses.GetHealthResponse 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 { if err != nil {
return getHealthResponse.Message, err 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") 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 { if err != nil {
return getMembreResponse.Data.Membre, err 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) { 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)
} }

View file

@ -4,7 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"git.agecem.com/agecem/bottin/v5/models" "git.agecem.com/agecem/bottin/v6/models"
_ "github.com/jackc/pgx/stdlib" _ "github.com/jackc/pgx/stdlib"
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
"github.com/spf13/viper" "github.com/spf13/viper"

2
go.mod
View file

@ -1,4 +1,4 @@
module git.agecem.com/agecem/bottin/v5 module git.agecem.com/agecem/bottin/v6
go 1.21.1 go 1.21.1

View file

@ -1,6 +1,6 @@
package handlers package handlers
import "git.agecem.com/agecem/bottin/v5/data" import "git.agecem.com/agecem/bottin/v6/data"
type Handler struct { type Handler struct {
DataClient *data.DataClient DataClient *data.DataClient

View file

@ -3,8 +3,8 @@ package handlers
import ( import (
"net/http" "net/http"
"git.agecem.com/agecem/bottin/v5/data" "git.agecem.com/agecem/bottin/v6/data"
"git.agecem.com/agecem/bottin/v5/responses" "git.agecem.com/agecem/bottin/v6/responses"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )
@ -30,7 +30,7 @@ func (h *Handler) GetHealth(c echo.Context) error {
} }
response.StatusCode = http.StatusOK response.StatusCode = http.StatusOK
response.Message = "Bottin API v5 is ready" response.Message = "Bottin API v6 is ready"
return c.JSON(response.StatusCode, response) return c.JSON(response.StatusCode, response)
} }

View file

@ -5,8 +5,8 @@ import (
"io" "io"
"net/http" "net/http"
"git.agecem.com/agecem/bottin/v5/models" "git.agecem.com/agecem/bottin/v6/models"
"git.agecem.com/agecem/bottin/v5/responses" "git.agecem.com/agecem/bottin/v6/responses"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/gocarina/gocsv" "github.com/gocarina/gocsv"

View file

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"git.agecem.com/agecem/bottin/v5/responses" "git.agecem.com/agecem/bottin/v6/responses"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )

View file

@ -1,6 +1,6 @@
package main package main
import "git.agecem.com/agecem/bottin/v5/cmd" import "git.agecem.com/agecem/bottin/v6/cmd"
func main() { func main() {
cmd.Execute() cmd.Execute()

View file

@ -2,7 +2,7 @@ package responses
import ( import (
"codeberg.org/vlbeaudoin/voki/response" "codeberg.org/vlbeaudoin/voki/response"
"git.agecem.com/agecem/bottin/v5/models" "git.agecem.com/agecem/bottin/v6/models"
) )
type ListMembresResponse struct { type ListMembresResponse struct {

View file

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"git.agecem.com/agecem/bottin/v5/data" "git.agecem.com/agecem/bottin/v6/data"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )