add booking retrieval for user
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 32s
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 32s
This commit is contained in:
@@ -37,7 +37,7 @@ func (h Handler) BookDriverJourney(passengerid string, driverid string, journeyi
|
||||
return &booking, nil
|
||||
}
|
||||
|
||||
func (h Handler) GetBookings(startdate time.Time, enddate time.Time) ([]*types.Booking, error) {
|
||||
func (h Handler) GetBookings(startdate time.Time, enddate time.Time, passengerid string) ([]*types.Booking, error) {
|
||||
res := []*types.Booking{}
|
||||
|
||||
bookings, err := h.Storage.GetAllBookings()
|
||||
@@ -48,7 +48,9 @@ func (h Handler) GetBookings(startdate time.Time, enddate time.Time) ([]*types.B
|
||||
|
||||
for _, b := range bookings {
|
||||
if b.Journey.DriverDepartureDate.After(startdate) && b.Journey.DriverDepartureDate.Before(enddate) {
|
||||
res = append(res, b)
|
||||
if passengerid == "" || b.PassengerId == passengerid {
|
||||
res = append(res, b)
|
||||
}
|
||||
}
|
||||
}
|
||||
return res, nil
|
||||
|
||||
Reference in New Issue
Block a user