resolve conflict and fix
This commit is contained in:
parent
0c8cf6be60
commit
6e6b559356
|
@ -1,8 +1,6 @@
|
||||||
package handlers
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
|
|
||||||
"git.coopgo.io/coopgo-platform/fleets/storage"
|
"git.coopgo.io/coopgo-platform/fleets/storage"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
@ -26,9 +24,9 @@ func (h FleetsHandler) GetBooking(id string) (booking *storage.Booking, err erro
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if booking.Deleted {
|
// if booking.Deleted {
|
||||||
return nil, errors.New("booking was deleted")
|
// return nil, errors.New("booking was deleted")
|
||||||
}
|
// }
|
||||||
|
|
||||||
vehicle, err := h.storage.GetVehicle(booking.Vehicleid)
|
vehicle, err := h.storage.GetVehicle(booking.Vehicleid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -18,7 +18,7 @@ type Booking struct {
|
||||||
Unavailableto time.Time `json:"unavailableto"`
|
Unavailableto time.Time `json:"unavailableto"`
|
||||||
Data map[string]any `json:"data"`
|
Data map[string]any `json:"data"`
|
||||||
|
|
||||||
Deleted bool
|
Deleted bool `json:"deleted"`
|
||||||
Vehicle Vehicle `json:"vehicle" bson:"-"`
|
Vehicle Vehicle `json:"vehicle" bson:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,8 @@ func (s MongoDBStorage) GetBookingsForDriver(driver string) (bookings []Booking,
|
||||||
func (s MongoDBStorage) DeleteBooking(bookingid string) error {
|
func (s MongoDBStorage) DeleteBooking(bookingid string) error {
|
||||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
collection := s.Client.Database(s.DbName).Collection(s.Collections["bookings"])
|
||||||
|
|
||||||
|
fmt.Println(bookingid)
|
||||||
|
|
||||||
_, err := collection.UpdateOne(
|
_, err := collection.UpdateOne(
|
||||||
context.TODO(),
|
context.TODO(),
|
||||||
bson.M{"_id": bookingid},
|
bson.M{"_id": bookingid},
|
||||||
|
|
Loading…
Reference in New Issue