diff --git a/handlers/bookings.go b/handlers/bookings.go index 5b5819c..7b741ba 100644 --- a/handlers/bookings.go +++ b/handlers/bookings.go @@ -1,8 +1,6 @@ package handlers import ( - "errors" - "git.coopgo.io/coopgo-platform/fleets/storage" "github.com/google/uuid" ) @@ -26,9 +24,9 @@ func (h FleetsHandler) GetBooking(id string) (booking *storage.Booking, err erro return nil, err } - if booking.Deleted { - return nil, errors.New("booking was deleted") - } + // if booking.Deleted { + // return nil, errors.New("booking was deleted") + // } vehicle, err := h.storage.GetVehicle(booking.Vehicleid) if err != nil { diff --git a/storage/bookings.go b/storage/bookings.go index 7c48857..93ab853 100644 --- a/storage/bookings.go +++ b/storage/bookings.go @@ -18,7 +18,7 @@ type Booking struct { Unavailableto time.Time `json:"unavailableto"` Data map[string]any `json:"data"` - Deleted bool + Deleted bool `json:"deleted"` Vehicle Vehicle `json:"vehicle" bson:"-"` } diff --git a/storage/mongodb.go b/storage/mongodb.go index 9468ecf..1cd3488 100644 --- a/storage/mongodb.go +++ b/storage/mongodb.go @@ -225,6 +225,8 @@ func (s MongoDBStorage) GetBookingsForDriver(driver string) (bookings []Booking, func (s MongoDBStorage) DeleteBooking(bookingid string) error { collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"]) + fmt.Println(bookingid) + _, err := collection.UpdateOne( context.TODO(), bson.M{"_id": bookingid}, @@ -237,7 +239,7 @@ func (s MongoDBStorage) DeleteBooking(bookingid string) error { } -/////////////////////update/////////////// +// ///////////////////update/////////////// func (s MongoDBStorage) UpdateVehicle(vehicle Vehicle) error { collection := s.Client.Database(s.DbName).Collection(s.Collections["vehicles"]) if _, err := collection.ReplaceOne(context.TODO(), bson.M{"_id": vehicle.ID}, vehicle); err != nil {