implement remote call for remote action

This commit is contained in:
mr
2024-08-12 16:11:25 +02:00
parent 4575f9ad3f
commit 2ac24779cd
26 changed files with 312 additions and 144 deletions

View File

@@ -6,6 +6,7 @@ import (
"time"
"cloud.o-forge.io/core/oc-lib/models/utils"
"cloud.o-forge.io/core/oc-lib/tools"
"github.com/google/uuid"
)
@@ -38,6 +39,29 @@ func (d ScheduledType) EnumIndex() int {
return int(d)
}
type WorkflowExecutions struct {
Executions []*WorkflowExecution `json:"executions" bson:"executions"`
}
func (dma *WorkflowExecutions) Deserialize(j map[string]interface{}) *WorkflowExecutions {
b, err := json.Marshal(j)
if err != nil {
return nil
}
json.Unmarshal(b, dma)
return dma
}
func (dma *WorkflowExecutions) Serialize() map[string]interface{} {
var m map[string]interface{}
b, err := json.Marshal(dma)
if err != nil {
return nil
}
json.Unmarshal(b, &m)
return m
}
type WorkflowExecution struct {
utils.AbstractObject
ExecDate *time.Time `json:"execution_date,omitempty" bson:"execution_date,omitempty" validate:"required"`
@@ -73,9 +97,9 @@ func (d *WorkflowExecution) GetName() string {
return d.UUID + "_" + d.ExecDate.String()
}
func (d *WorkflowExecution) GetAccessor() utils.Accessor {
func (d *WorkflowExecution) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
data := New()
data.SetLogger(utils.WORKFLOW_EXECUTION)
data.Init(utils.WORKFLOW_EXECUTION, caller)
return data
}