logic to update vehicles

This commit is contained in:
soukainna
2023-05-19 11:26:36 +02:00
parent d48c1ccf8e
commit 41bf03682c
4 changed files with 41 additions and 3 deletions

View File

@@ -236,3 +236,14 @@ func (s MongoDBStorage) DeleteBooking(bookingid string) error {
return err
}
/////////////////////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 {
fmt.Println(err)
return err
}
return nil
}