list all bookings

This commit is contained in:
2024-12-16 10:12:40 +01:00
parent 3ad5711ae7
commit 50e939c455
2 changed files with 25 additions and 13 deletions

View File

@@ -128,17 +128,33 @@ func (h *ApplicationHandler) DriversJourney(w http.ResponseWriter, r *http.Reque
h.Renderer.SolidarityServiceBooking(w, r, booking)
}else {
}else {
h.Renderer.SolidarityService(w, r)
accounts, err := h.services.GRPC.SolidarityService.GetAllPassengers(context.TODO(), &emptypb.Empty{})
drivers, err := h.services.GRPC.SolidarityService.GetAllDrivers(context.TODO(), &emptypb.Empty{})
bookings, err := h.services.GRPC.SolidarityService.GetAllBookingsSolidarity(context.TODO(), &emptypb.Empty{})
parcourmobAccounts, err := h.beneficiaries(r)
if err != nil {
fmt.Println(err)
w.WriteHeader(http.StatusBadRequest)
}
cacheid := uuid.NewString()
h.cache.PutWithTTL(cacheid, accounts, 1*time.Hour)
h.Renderer.SolidarityService(w, r, accounts, drivers, parcourmobAccounts, bookings, cacheid)
}
}
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{})
drivers, err := h.services.GRPC.SolidarityService.GetAllDrivers(context.TODO(), &emptypb.Empty{})
bookings, err := h.services.GRPC.SolidarityService.GetAllBookingsSolidarity(context.TODO(), &emptypb.Empty{})
parcourmobAccounts, err := h.beneficiaries(r)
if err != nil {
@@ -148,10 +164,10 @@ 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, drivers, parcourmobAccounts, cacheid)
h.Renderer.SolidarityService(w, r, accounts, drivers, parcourmobAccounts, bookings ,cacheid)
}
func (h *ApplicationHandler) CreateDriver (w http.ResponseWriter, r *http.Request) {
func (h *ApplicationHandler) CreateDriver(w http.ResponseWriter, r *http.Request) {
if r.Method== "POST" {