Compare commits
No commits in common. "6ab774cc43973e33b58fe23be1bb4038f8a935cd" and "34f01e9740ec52c608c9aaf25ef2ba8e04f1c404" have entirely different histories.
6ab774cc43
...
34f01e9740
@ -6,6 +6,7 @@ import (
|
|||||||
"cloud.o-forge.io/core/oc-lib/dbs"
|
"cloud.o-forge.io/core/oc-lib/dbs"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/common/enum"
|
"cloud.o-forge.io/core/oc-lib/models/common/enum"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/common/models"
|
"cloud.o-forge.io/core/oc-lib/models/common/models"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/common/pricing"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||||
"cloud.o-forge.io/core/oc-lib/tools"
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
@ -15,8 +16,8 @@ import (
|
|||||||
* Booking is a struct that represents a booking
|
* Booking is a struct that represents a booking
|
||||||
*/
|
*/
|
||||||
type Booking struct {
|
type Booking struct {
|
||||||
utils.AbstractObject // AbstractObject contains the basic fields of an object (id, name)
|
utils.AbstractObject // AbstractObject contains the basic fields of an object (id, name)
|
||||||
PricedItem map[string]interface{} `json:"priced_item,omitempty" bson:"priced_item,omitempty"` // We need to add the validate:"required" tag once the pricing feature is implemented, removed to avoid handling the error
|
PricedItem pricing.PricedItemITF `json:"priced_item,omitempty" bson:"priced_item,omitempty"` // We need to add the validate:"required" tag once the pricing feature is implemented, removed to avoid handling the error
|
||||||
|
|
||||||
ResumeMetrics map[string]map[string]models.MetricResume `json:"resume_metrics,omitempty" bson:"resume_metrics,omitempty"`
|
ResumeMetrics map[string]map[string]models.MetricResume `json:"resume_metrics,omitempty" bson:"resume_metrics,omitempty"`
|
||||||
ExecutionMetrics map[string][]models.MetricsSnapshot `json:"metrics,omitempty" bson:"metrics,omitempty"`
|
ExecutionMetrics map[string][]models.MetricsSnapshot `json:"metrics,omitempty" bson:"metrics,omitempty"`
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package workflow_execution
|
package workflow_execution
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -142,16 +141,13 @@ func (d *WorkflowExecution) buyEach(bs pricing.BillingStrategy, executionsID str
|
|||||||
if s := priced.GetLocationStart(); s != nil {
|
if s := priced.GetLocationStart(); s != nil {
|
||||||
start = *s
|
start = *s
|
||||||
}
|
}
|
||||||
var m map[string]interface{}
|
|
||||||
b, _ := json.Marshal(priced)
|
|
||||||
json.Unmarshal(b, &m)
|
|
||||||
end := start.Add(time.Duration(priced.GetExplicitDurationInS()) * time.Second)
|
end := start.Add(time.Duration(priced.GetExplicitDurationInS()) * time.Second)
|
||||||
bookingItem := &purchase_resource.PurchaseResource{
|
bookingItem := &purchase_resource.PurchaseResource{
|
||||||
AbstractObject: utils.AbstractObject{
|
AbstractObject: utils.AbstractObject{
|
||||||
UUID: uuid.New().String(),
|
UUID: uuid.New().String(),
|
||||||
Name: d.GetName() + "_" + executionsID + "_" + wfID,
|
Name: d.GetName() + "_" + executionsID + "_" + wfID,
|
||||||
},
|
},
|
||||||
PricedItem: m,
|
PricedItem: priced,
|
||||||
ExecutionsID: executionsID,
|
ExecutionsID: executionsID,
|
||||||
DestPeerID: priced.GetCreatorID(),
|
DestPeerID: priced.GetCreatorID(),
|
||||||
ResourceID: priced.GetID(),
|
ResourceID: priced.GetID(),
|
||||||
@ -193,15 +189,12 @@ func (d *WorkflowExecution) bookEach(executionsID string, wfID string, dt tools.
|
|||||||
start = *s
|
start = *s
|
||||||
}
|
}
|
||||||
end := start.Add(time.Duration(priced.GetExplicitDurationInS()) * time.Second)
|
end := start.Add(time.Duration(priced.GetExplicitDurationInS()) * time.Second)
|
||||||
var m map[string]interface{}
|
|
||||||
b, _ := json.Marshal(priced)
|
|
||||||
json.Unmarshal(b, &m)
|
|
||||||
bookingItem := &booking.Booking{
|
bookingItem := &booking.Booking{
|
||||||
AbstractObject: utils.AbstractObject{
|
AbstractObject: utils.AbstractObject{
|
||||||
UUID: uuid.New().String(),
|
UUID: uuid.New().String(),
|
||||||
Name: d.GetName() + "_" + executionsID + "_" + wfID,
|
Name: d.GetName() + "_" + executionsID + "_" + wfID,
|
||||||
},
|
},
|
||||||
PricedItem: m,
|
PricedItem: priced,
|
||||||
ExecutionsID: executionsID,
|
ExecutionsID: executionsID,
|
||||||
State: enum.SCHEDULED,
|
State: enum.SCHEDULED,
|
||||||
ResourceID: priced.GetID(),
|
ResourceID: priced.GetID(),
|
||||||
|
Loading…
Reference in New Issue
Block a user