workflow scheduler create booking with a booking execution lot id

This commit is contained in:
mr
2025-02-12 15:27:05 +01:00
parent 3e85fdc779
commit c0e6247fb8
2 changed files with 7 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
package booking
import (
"errors"
"time"
"cloud.o-forge.io/core/oc-lib/dbs"
@@ -33,7 +34,11 @@ func (a *bookingMongoAccessor) DeleteOne(id string) (utils.DBObject, int, error)
}
func (a *bookingMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
return utils.GenericUpdateOne(set, id, a, &Booking{})
if set.(*Booking).State == 0 {
return nil, 400, errors.New("state is required")
}
realSet := &Booking{State: set.(*Booking).State}
return utils.GenericUpdateOne(realSet, id, a, &Booking{})
}
func (a *bookingMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {