Return handling
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 40s
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 40s
This commit is contained in:
@@ -107,6 +107,11 @@ func (s MemoryStorage) GetDriverJourney(id string) (res *types.DriverJourney, er
|
||||
return
|
||||
}
|
||||
|
||||
func (s MemoryStorage) UpdateDriverJourney(journey types.DriverJourney) error {
|
||||
s.DriverJourneys[journey.Id] = &journey
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s MemoryStorage) CreateBooking(booking types.Booking) error {
|
||||
if booking.Id == "" {
|
||||
booking.Id = uuid.NewString()
|
||||
|
||||
@@ -166,6 +166,14 @@ func (s MongoDBStorage) GetDriverJourney(id string) (*types.DriverJourney, error
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) UpdateDriverJourney(journey types.DriverJourney) error {
|
||||
if _, err := s.Collections.DriverJourneys.ReplaceOne(context.Background(), bson.M{"_id": journey.Id}, journey); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) CreateBooking(booking types.Booking) error {
|
||||
if booking.Id == "" {
|
||||
booking.Id = uuid.NewString()
|
||||
|
||||
@@ -18,6 +18,7 @@ type Storage interface {
|
||||
|
||||
PushDriverJourneys([]*types.DriverJourney) error
|
||||
GetDriverJourney(id string) (*types.DriverJourney, error)
|
||||
UpdateDriverJourney(types.DriverJourney) error
|
||||
|
||||
CreateBooking(types.Booking) error
|
||||
GetAllBookings() ([]*types.Booking, error)
|
||||
|
||||
Reference in New Issue
Block a user