solidarity transport update
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 2m4s
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 2m4s
This commit is contained in:
@@ -9,15 +9,15 @@ import (
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func (h Handler) BookDriverJourney(passengerid string, driverid string, journeyid string) error {
|
||||
func (h Handler) BookDriverJourney(passengerid string, driverid string, journeyid string) (*types.Booking, error) {
|
||||
journey, err := h.Storage.GetDriverJourney(journeyid)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("could not find driver journey")
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if journey.DriverId != driverid {
|
||||
return errors.New("not authorized : journey id driver and driverid mismatch")
|
||||
return nil, errors.New("not authorized : journey id driver and driverid mismatch")
|
||||
}
|
||||
|
||||
booking := types.Booking{
|
||||
@@ -31,10 +31,10 @@ func (h Handler) BookDriverJourney(passengerid string, driverid string, journeyi
|
||||
|
||||
if err := h.Storage.CreateBooking(booking); err != nil {
|
||||
log.Error().Err(err).Msg("error creating booking")
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nil
|
||||
return &booking, nil
|
||||
}
|
||||
|
||||
func (h Handler) GetBookings(startdate time.Time, enddate time.Time) ([]*types.Booking, error) {
|
||||
|
||||
Reference in New Issue
Block a user