getAllDrivers
This commit is contained in:
parent
163ffefbfb
commit
f43d02c762
|
@ -133,6 +133,8 @@ func (h *ApplicationHandler) DriversJourney(w http.ResponseWriter, r *http.Reque
|
||||||
func (h *ApplicationHandler) SolidarityService (w http.ResponseWriter, r *http.Request) {
|
func (h *ApplicationHandler) SolidarityService (w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
accounts, err := h.services.GRPC.SolidarityService.GetAllPassengers(context.TODO(), &emptypb.Empty{})
|
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)
|
parcourmobAccounts, err := h.beneficiaries(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
@ -140,7 +142,6 @@ func (h *ApplicationHandler) SolidarityService (w http.ResponseWriter, r *http.R
|
||||||
}
|
}
|
||||||
cacheid := uuid.NewString()
|
cacheid := uuid.NewString()
|
||||||
h.cache.PutWithTTL(cacheid, accounts, 1*time.Hour)
|
h.cache.PutWithTTL(cacheid, accounts, 1*time.Hour)
|
||||||
|
|
||||||
|
h.Renderer.BeneficiariesSolidarity(w, r, accounts, drivers, parcourmobAccounts, cacheid)
|
||||||
h.Renderer.BeneficiariesSolidarity(w, r, accounts, parcourmobAccounts, cacheid)
|
|
||||||
}
|
}
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
solidarity_service "git.coopgo.io/sbouaram/solidarity-service/servers/grpc/proto"
|
|
||||||
mobilityaccountsstorage "git.coopgo.io/coopgo-platform/mobility-accounts/storage"
|
mobilityaccountsstorage "git.coopgo.io/coopgo-platform/mobility-accounts/storage"
|
||||||
|
solidarity_service "git.coopgo.io/sbouaram/solidarity-service/servers/grpc/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
const solidarityserviceMenu = "solidarity_service"
|
const solidarityserviceMenu = "solidarity_service"
|
||||||
|
@ -22,10 +22,11 @@ type SolidarityListState struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type BeneficiariesSolidarityListState struct {
|
type BeneficiariesSolidarityListState struct {
|
||||||
Count int `json:"count"`
|
Count int `json:"count"`
|
||||||
CacheId string `json:"cache_id"`
|
CacheId string `json:"cache_id"`
|
||||||
BeneficiariesSolidarity *solidarity_service.GetAllPassengersResponse `json:"beneficiariessolidarity"`
|
BeneficiariesSolidarity *solidarity_service.GetAllPassengersResponse `json:"beneficiariessolidarity"`
|
||||||
Beneficiaries []mobilityaccountsstorage.Account `json:"beneficiaries"`
|
Beneficiaries []mobilityaccountsstorage.Account `json:"beneficiaries"`
|
||||||
|
Drivers *solidarity_service.GetAllDriversResponse `json:"drivers"`
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +35,6 @@ type SolidarityBookingsState struct {
|
||||||
Beneficiaries []mobilityaccountsstorage.Account `json:"beneficiaries"`
|
Beneficiaries []mobilityaccountsstorage.Account `json:"beneficiaries"`
|
||||||
BeneficiariesSolidarity *solidarity_service.GetAllPassengersResponse `json:"beneficiariessolidarity"`
|
BeneficiariesSolidarity *solidarity_service.GetAllPassengersResponse `json:"beneficiariessolidarity"`
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s BeneficiariesSolidarityListState) JSON() template.JS {
|
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)
|
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")
|
files := renderer.ThemeConfig.GetStringSlice("views.solidarity_service.list.files")
|
||||||
state := NewState(r, renderer.ThemeConfig, solidarityserviceMenu)
|
state := NewState(r, renderer.ThemeConfig, solidarityserviceMenu)
|
||||||
state.ViewState = BeneficiariesSolidarityListState{
|
state.ViewState = BeneficiariesSolidarityListState{
|
||||||
|
@ -88,6 +88,7 @@ func (renderer *Renderer) BeneficiariesSolidarity(w http.ResponseWriter, r *http
|
||||||
CacheId: cacheid,
|
CacheId: cacheid,
|
||||||
Beneficiaries: parcourmobAccounts,
|
Beneficiaries: parcourmobAccounts,
|
||||||
BeneficiariesSolidarity: accounts,
|
BeneficiariesSolidarity: accounts,
|
||||||
|
Drivers: drivers,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue