add filter in export fleets

This commit is contained in:
Nicolas CARON 2023-06-02 14:42:55 +02:00
parent ddb08cf671
commit b717be9b99
1 changed files with 9 additions and 15 deletions

View File

@ -5,12 +5,14 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"git.coopgo.io/coopgo-apps/parcoursmob/utils/identification"
fleets "git.coopgo.io/coopgo-platform/fleets/grpcapi" fleets "git.coopgo.io/coopgo-platform/fleets/grpcapi"
fleetsstorage "git.coopgo.io/coopgo-platform/fleets/storage" fleetsstorage "git.coopgo.io/coopgo-platform/fleets/storage"
groupsmanagement "git.coopgo.io/coopgo-platform/groups-management/grpcapi" groupsmanagement "git.coopgo.io/coopgo-platform/groups-management/grpcapi"
groupsstorage "git.coopgo.io/coopgo-platform/groups-management/storage" groupsstorage "git.coopgo.io/coopgo-platform/groups-management/storage"
accounts "git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi" accounts "git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
accountsstorage "git.coopgo.io/coopgo-platform/mobility-accounts/storage" accountsstorage "git.coopgo.io/coopgo-platform/mobility-accounts/storage"
"git.coopgo.io/coopgo-platform/groups-management/storage"
"github.com/xuri/excelize/v2" "github.com/xuri/excelize/v2"
) )
@ -18,7 +20,6 @@ func (h *ExportsHandler) Bookings(w http.ResponseWriter, r *http.Request) {
vehicles := map[string]fleetsstorage.Vehicle{} vehicles := map[string]fleetsstorage.Vehicle{}
bookings := []fleetsstorage.Booking{} bookings := []fleetsstorage.Booking{}
reequest := &fleets.GetVehiclesRequest{ reequest := &fleets.GetVehiclesRequest{
Namespaces: []string{"parcoursmob"}, Namespaces: []string{"parcoursmob"},
} }
@ -123,21 +124,14 @@ func (h *ExportsHandler) Bookings(w http.ResponseWriter, r *http.Request) {
} }
} }
} }
fmt.Println("\n"+bookedbygroup+"\n")
// for _, a := range vehicle.Administrators { // filter by group
// if a == bookedbygroup { g := r.Context().Value(identification.GroupKey)
// fmt.Println("\n"+a+"\n") group := g.(storage.Group)
// }
// }
// group := "" if bookedbygroup != group.ID {
continue
// fmt.Printf("\n"+group+"\n") }
// if bookedbygroup == group {
// continue
// }
beneficiary := beneficiaries_map[b.Driver] beneficiary := beneficiaries_map[b.Driver]
adminunavailability := false adminunavailability := false