Improve passenger pickup/drop handling
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 3m8s
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 3m8s
This commit is contained in:
@@ -304,8 +304,24 @@ func (s MongoDBStorage) GetAllBookings() ([]internal.Booking, error) {
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) UpdateBookingStatus(bookingid string, status string) error {
|
||||
// TODO implement UpdateBookingStatus
|
||||
return errors.New("MongoDB Storage - UpdateBookingStatus not implemented")
|
||||
log.Debug().Str("booking id", bookingid).Str("status", status).Msg("update booking status in DB")
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
||||
|
||||
filter := bson.M{"_id": bookingid}
|
||||
update := bson.M{"$set": bson.M{"status": status}}
|
||||
|
||||
result, err := collection.UpdateOne(context.TODO(), filter, update)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("error updating booking status")
|
||||
return err
|
||||
}
|
||||
|
||||
if result.MatchedCount == 0 {
|
||||
return errors.New("booking not found")
|
||||
}
|
||||
|
||||
log.Debug().Int64("modified count", result.ModifiedCount).Msg("booking status updated")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) PersistedKVPut(documents []any) error {
|
||||
|
||||
Reference in New Issue
Block a user