Order Flow Payment Draft

This commit is contained in:
mr
2025-01-13 11:24:07 +01:00
parent be3b09b683
commit 21a7ff9010
22 changed files with 436 additions and 490 deletions

View File

@@ -1,20 +1,10 @@
package resources
import (
"time"
"cloud.o-forge.io/core/oc-lib/models/utils"
"cloud.o-forge.io/core/oc-lib/tools"
)
type ExploitedResourceSet struct {
DataResources []*CustomizedDataResource `bson:"-" json:"data_resources,omitempty"`
StorageResources []*CustomizedStorageResource `bson:"-" json:"storage_resources,omitempty"`
ProcessingResources []*CustomizedProcessingResource `bson:"-" json:"processing_resources,omitempty"`
ComputeResources []*CustomizedComputeResource `bson:"-" json:"compute_resources,omitempty"`
WorkflowResources []*CustomizedWorkflowResource `bson:"-" json:"workflow_resources,omitempty"`
}
type ResourceSet struct {
Datas []string `bson:"datas,omitempty" json:"datas,omitempty"`
Storages []string `bson:"storages,omitempty" json:"storages,omitempty"`
@@ -65,28 +55,10 @@ func (r *ResourceSet) Fill(request *tools.APIRequest) {
}
}
type ItemExploitedResource struct {
Data *CustomizedDataResource `bson:"data,omitempty" json:"data,omitempty"`
Processing *CustomizedProcessingResource `bson:"processing,omitempty" json:"processing,omitempty"`
Storage *CustomizedStorageResource `bson:"storage,omitempty" json:"storage,omitempty"`
Compute *CustomizedComputeResource `bson:"compute,omitempty" json:"compute,omitempty"`
Workflow *CustomizedWorkflowResource `bson:"workflow,omitempty" json:"workflow,omitempty"`
}
func (w *ItemExploitedResource) SetItemEndUsage(end time.Time) {
for _, item := range []ShallowResourceInterface{w.Data, w.Processing, w.Storage, w.Compute, w.Workflow} {
if item != nil {
item.SetItemEndUsage(end)
}
}
}
func (w *ItemExploitedResource) SetItemStartUsage(start time.Time) {
for _, item := range []ShallowResourceInterface{w.Data, w.Processing, w.Storage, w.Compute, w.Workflow} {
if item != nil {
item.SetItemStartUsage(start)
}
}
type ItemResource struct {
Data *DataResource `bson:"data,omitempty" json:"data,omitempty"`
Processing *ProcessingResource `bson:"processing,omitempty" json:"processing,omitempty"`
Storage *StorageResource `bson:"storage,omitempty" json:"storage,omitempty"`
Compute *ComputeResource `bson:"compute,omitempty" json:"compute,omitempty"`
Workflow *WorkflowResource `bson:"workflow,omitempty" json:"workflow,omitempty"`
}