Ajouter pointers à clients en paramètres à apihandler.New

This commit is contained in:
Victor Lacasse-Beaudoin 2023-09-16 17:44:38 -04:00
parent 682d8fc6aa
commit 6123799650
2 changed files with 11 additions and 6 deletions

View file

@ -32,16 +32,14 @@ var apiCmd = &cobra.Command{
v0 := e.Group("/v0")
handler := apihandler.New()
handler.BottinAPIClient = bottindata.NewApiClient("bottin", "localhost", "http", 1312)
bottinApiClient := bottindata.NewApiClient("bottin", "localhost", "http", 1312)
dbClient, err := dbclient.New("db", "bottinag", "bottinag", "bottinag", 5432, false)
if err != nil {
log.Fatal(err)
}
handler.DBClient = dbClient
handler := apihandler.New(bottinApiClient, dbClient)
if err := handler.DBClient.CreateTablesIfNotExist(); err != nil {
log.Fatal(err)