Add a Name to Workflow Execution
This commit is contained in:
parent
dd5f8f5b2d
commit
d2484e84f0
@ -56,6 +56,9 @@ func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delet
|
||||
}
|
||||
for s := c.Next(*realData.Schedule.Start); !s.IsZero() && s.Before(*realData.Schedule.End); s = c.Next(s) {
|
||||
obj := &workflow_execution.WorkflowExecution{
|
||||
AbstractObject: utils.AbstractObject{
|
||||
Name: realData.Schedule.Name,
|
||||
},
|
||||
ExecDate: &s,
|
||||
EndDate: realData.Schedule.End,
|
||||
State: 1,
|
||||
@ -66,6 +69,9 @@ func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delet
|
||||
|
||||
} else {
|
||||
obj := &workflow_execution.WorkflowExecution{
|
||||
AbstractObject: utils.AbstractObject{
|
||||
Name: realData.Schedule.Name,
|
||||
},
|
||||
ExecDate: realData.Schedule.Start,
|
||||
EndDate: realData.Schedule.End,
|
||||
State: 1,
|
||||
|
@ -4,6 +4,7 @@ import "time"
|
||||
|
||||
type WorkflowSchedule struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name" bson:"name" validate:"required"`
|
||||
Start *time.Time `json:"start" bson:"start" validate:"required"`
|
||||
End *time.Time `json:"end,omitempty" bson:"end,omitempty"`
|
||||
Cron string `json:"cron,omitempty" bson:"cron,omitempty"`
|
||||
|
@ -38,7 +38,7 @@ func (d ScheduledType) EnumIndex() int {
|
||||
}
|
||||
|
||||
type WorkflowExecution struct {
|
||||
UUID string `json:"id,omitempty" bson:"id,omitempty" validate:"required"`
|
||||
utils.AbstractObject
|
||||
ExecDate *time.Time `json:"execution_date,omitempty" bson:"execution_date,omitempty" validate:"required"`
|
||||
EndDate *time.Time `json:"end_date,omitempty" bson:"end_date,omitempty"`
|
||||
State int64 `json:"state,omitempty" bson:"state,omitempty"`
|
||||
|
@ -53,18 +53,26 @@ func (wfa workflowExecutionMongoAccessor) LoadAll() ([]utils.ShallowDBObject, in
|
||||
return nil, 404, err
|
||||
}
|
||||
for _, r := range results {
|
||||
objs = append(objs, &r)
|
||||
objs = append(objs, &r.AbstractObject)
|
||||
}
|
||||
return objs, 200, nil
|
||||
}
|
||||
|
||||
func (wfa *workflowExecutionMongoAccessor) Search(filters *dbs.Filters, search string) ([]utils.ShallowDBObject, int, error) {
|
||||
objs := []utils.ShallowDBObject{}
|
||||
if (filters == nil || len(filters.And) == 0 || len(filters.Or) == 0) && search != "" {
|
||||
filters = &dbs.Filters{
|
||||
Or: map[string][]dbs.Filter{
|
||||
"abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
},
|
||||
}
|
||||
}
|
||||
res_mongo, code, err := mongo.MONGOService.Search(filters, wfa.GetType())
|
||||
if err != nil {
|
||||
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
||||
return nil, code, err
|
||||
}
|
||||
|
||||
var results []WorkflowExecution
|
||||
if err = res_mongo.All(mongo.MngoCtx, &results); err != nil {
|
||||
return nil, 404, err
|
||||
|
Loading…
Reference in New Issue
Block a user