solidarity transport update
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 2m4s

This commit is contained in:
2025-05-23 09:45:37 +02:00
parent ea0f2544a7
commit 860e8122b2
9 changed files with 170 additions and 146 deletions

View File

@@ -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) {