From f43d02c762bb29eb69331d867096d182ca4394a8 Mon Sep 17 00:00:00 2001 From: Maxime Date: Fri, 29 Nov 2024 11:43:47 +0100 Subject: [PATCH] getAllDrivers --- handlers/application/solidarity_service.go | 7 ++++--- renderer/solidarity_service.go | 15 ++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/handlers/application/solidarity_service.go b/handlers/application/solidarity_service.go index 4bcc052..be0fa24 100644 --- a/handlers/application/solidarity_service.go +++ b/handlers/application/solidarity_service.go @@ -133,6 +133,8 @@ func (h *ApplicationHandler) DriversJourney(w http.ResponseWriter, r *http.Reque func (h *ApplicationHandler) SolidarityService (w http.ResponseWriter, r *http.Request) { accounts, err := h.services.GRPC.SolidarityService.GetAllPassengers(context.TODO(), &emptypb.Empty{}) + drivers, err := h.services.GRPC.SolidarityService.GetAllDrivers(context.TODO(), &emptypb.Empty{}) + parcourmobAccounts, err := h.beneficiaries(r) if err != nil { fmt.Println(err) @@ -140,7 +142,6 @@ func (h *ApplicationHandler) SolidarityService (w http.ResponseWriter, r *http.R } cacheid := uuid.NewString() h.cache.PutWithTTL(cacheid, accounts, 1*time.Hour) - - - h.Renderer.BeneficiariesSolidarity(w, r, accounts, parcourmobAccounts, cacheid) + + h.Renderer.BeneficiariesSolidarity(w, r, accounts, drivers, parcourmobAccounts, cacheid) } \ No newline at end of file diff --git a/renderer/solidarity_service.go b/renderer/solidarity_service.go index 7ba1f33..4b06698 100644 --- a/renderer/solidarity_service.go +++ b/renderer/solidarity_service.go @@ -5,8 +5,8 @@ import ( "html/template" "net/http" - solidarity_service "git.coopgo.io/sbouaram/solidarity-service/servers/grpc/proto" mobilityaccountsstorage "git.coopgo.io/coopgo-platform/mobility-accounts/storage" + solidarity_service "git.coopgo.io/sbouaram/solidarity-service/servers/grpc/proto" ) const solidarityserviceMenu = "solidarity_service" @@ -22,10 +22,11 @@ type SolidarityListState struct { } type BeneficiariesSolidarityListState struct { - Count int `json:"count"` - CacheId string `json:"cache_id"` - BeneficiariesSolidarity *solidarity_service.GetAllPassengersResponse `json:"beneficiariessolidarity"` - Beneficiaries []mobilityaccountsstorage.Account `json:"beneficiaries"` + Count int `json:"count"` + CacheId string `json:"cache_id"` + BeneficiariesSolidarity *solidarity_service.GetAllPassengersResponse `json:"beneficiariessolidarity"` + Beneficiaries []mobilityaccountsstorage.Account `json:"beneficiaries"` + Drivers *solidarity_service.GetAllDriversResponse `json:"drivers"` } @@ -34,7 +35,6 @@ type SolidarityBookingsState struct { Beneficiaries []mobilityaccountsstorage.Account `json:"beneficiaries"` BeneficiariesSolidarity *solidarity_service.GetAllPassengersResponse `json:"beneficiariessolidarity"` - } func (s BeneficiariesSolidarityListState) JSON() template.JS { @@ -80,7 +80,7 @@ func (renderer *Renderer) SolidarityService(w http.ResponseWriter, r *http.Reque renderer.Render("solidarity_service", w, r, files, state) } -func (renderer *Renderer) BeneficiariesSolidarity(w http.ResponseWriter, r *http.Request, accounts *solidarity_service.GetAllPassengersResponse, parcourmobAccounts []mobilityaccountsstorage.Account, cacheid string) { +func (renderer *Renderer) BeneficiariesSolidarity(w http.ResponseWriter, r *http.Request, accounts *solidarity_service.GetAllPassengersResponse, drivers *solidarity_service.GetAllDriversResponse, parcourmobAccounts []mobilityaccountsstorage.Account, cacheid string) { files := renderer.ThemeConfig.GetStringSlice("views.solidarity_service.list.files") state := NewState(r, renderer.ThemeConfig, solidarityserviceMenu) state.ViewState = BeneficiariesSolidarityListState{ @@ -88,6 +88,7 @@ func (renderer *Renderer) BeneficiariesSolidarity(w http.ResponseWriter, r *http CacheId: cacheid, Beneficiaries: parcourmobAccounts, BeneficiariesSolidarity: accounts, + Drivers: drivers, }