Return handling
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 40s

This commit is contained in:
2025-05-28 07:32:24 +02:00
parent 3d32c9a24a
commit d237401c81
17 changed files with 587 additions and 249 deletions

View File

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

View File

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

View File

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