light modification
This commit is contained in:
parent
745bb58c59
commit
b45e882559
@ -11,8 +11,8 @@ type ShallowDBObject interface {
|
|||||||
GenerateID()
|
GenerateID()
|
||||||
GetID() string
|
GetID() string
|
||||||
GetName() string
|
GetName() string
|
||||||
Deserialize(j map[string]interface{}, obj DBObject) DBObject
|
|
||||||
Serialize(obj DBObject) map[string]interface{}
|
Serialize(obj DBObject) map[string]interface{}
|
||||||
|
Deserialize(j map[string]interface{}, obj DBObject) DBObject
|
||||||
}
|
}
|
||||||
|
|
||||||
// DBObject is an interface that defines the basic methods for a DBObject
|
// DBObject is an interface that defines the basic methods for a DBObject
|
||||||
@ -20,33 +20,33 @@ type DBObject interface {
|
|||||||
GenerateID()
|
GenerateID()
|
||||||
GetID() string
|
GetID() string
|
||||||
GetName() string
|
GetName() string
|
||||||
GetCreatorID() string
|
|
||||||
IsDrafted() bool
|
IsDrafted() bool
|
||||||
StoreDraftDefault()
|
|
||||||
CanUpdate(set DBObject) (bool, DBObject)
|
|
||||||
CanDelete() bool
|
CanDelete() bool
|
||||||
|
StoreDraftDefault()
|
||||||
|
GetCreatorID() string
|
||||||
UpToDate(user string, create bool)
|
UpToDate(user string, create bool)
|
||||||
|
CanUpdate(set DBObject) (bool, DBObject)
|
||||||
VerifyAuth(request *tools.APIRequest) bool
|
VerifyAuth(request *tools.APIRequest) bool
|
||||||
Deserialize(j map[string]interface{}, obj DBObject) DBObject
|
|
||||||
Serialize(obj DBObject) map[string]interface{}
|
Serialize(obj DBObject) map[string]interface{}
|
||||||
GetAccessor(request *tools.APIRequest) Accessor
|
GetAccessor(request *tools.APIRequest) Accessor
|
||||||
|
Deserialize(j map[string]interface{}, obj DBObject) DBObject
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accessor is an interface that defines the basic methods for an Accessor
|
// Accessor is an interface that defines the basic methods for an Accessor
|
||||||
type Accessor interface {
|
type Accessor interface {
|
||||||
GetRequest() *tools.APIRequest
|
|
||||||
GetType() tools.DataType
|
|
||||||
GetUser() string
|
GetUser() string
|
||||||
GetPeerID() string
|
GetPeerID() string
|
||||||
GetGroups() []string
|
GetGroups() []string
|
||||||
|
ShouldVerifyAuth() bool
|
||||||
|
GetType() tools.DataType
|
||||||
GetLogger() *zerolog.Logger
|
GetLogger() *zerolog.Logger
|
||||||
GetCaller() *tools.HTTPCaller
|
GetCaller() *tools.HTTPCaller
|
||||||
ShouldVerifyAuth() bool
|
GetRequest() *tools.APIRequest
|
||||||
Search(filters *dbs.Filters, search string, isDraft bool) ([]ShallowDBObject, int, error)
|
|
||||||
LoadAll(isDraft bool) ([]ShallowDBObject, int, error)
|
|
||||||
LoadOne(id string) (DBObject, int, error)
|
LoadOne(id string) (DBObject, int, error)
|
||||||
DeleteOne(id string) (DBObject, int, error)
|
DeleteOne(id string) (DBObject, int, error)
|
||||||
CopyOne(data DBObject) (DBObject, int, error)
|
CopyOne(data DBObject) (DBObject, int, error)
|
||||||
StoreOne(data DBObject) (DBObject, int, error)
|
StoreOne(data DBObject) (DBObject, int, error)
|
||||||
|
LoadAll(isDraft bool) ([]ShallowDBObject, int, error)
|
||||||
UpdateOne(set DBObject, id string) (DBObject, int, error)
|
UpdateOne(set DBObject, id string) (DBObject, int, error)
|
||||||
|
Search(filters *dbs.Filters, search string, isDraft bool) ([]ShallowDBObject, int, error)
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ func (a *workflowExecutionMongoAccessor) LoadAll(isDraft bool) ([]utils.ShallowD
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *workflowExecutionMongoAccessor) Search(filters *dbs.Filters, search string, isDraft bool) ([]utils.ShallowDBObject, int, error) {
|
func (a *workflowExecutionMongoAccessor) Search(filters *dbs.Filters, search string, isDraft bool) ([]utils.ShallowDBObject, int, error) {
|
||||||
return utils.GenericSearch[*WorkflowExecutions](filters, search, (&WorkflowExecutions{}).GetObjectFilters(search), a.getExec(), isDraft, a)
|
return utils.GenericSearch[*WorkflowExecutions](filters, search, a.GetExecFilters(search), a.getExec(), isDraft, a)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *workflowExecutionMongoAccessor) getExec() func(utils.DBObject) utils.ShallowDBObject {
|
func (a *workflowExecutionMongoAccessor) getExec() func(utils.DBObject) utils.ShallowDBObject {
|
||||||
@ -76,3 +76,10 @@ func (a *workflowExecutionMongoAccessor) getExec() func(utils.DBObject) utils.Sh
|
|||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *workflowExecutionMongoAccessor) GetExecFilters(search string) *dbs.Filters {
|
||||||
|
return &dbs.Filters{
|
||||||
|
Or: map[string][]dbs.Filter{ // filter by name if no filters are provided
|
||||||
|
"abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search + "_execution"}},
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user