neooclib payment
This commit is contained in:
+28
-5
@@ -43,6 +43,7 @@ var paths = map[tools.DataType]map[tools.METHOD]string{ // paths to call other O
|
||||
|
||||
// @Title Search
|
||||
// @Description search workspace
|
||||
// @Param extend query string false "extend"
|
||||
// @Param search path string true "the word search you want to get"
|
||||
// @Param is_draft query string false "draft wished"
|
||||
// @Param offset query string false
|
||||
@@ -56,8 +57,13 @@ func (o *WorkflowController) Search() {
|
||||
// store and return Id or post with UUID
|
||||
search := o.Ctx.Input.Param(":search")
|
||||
isDraft := o.Ctx.Input.Query("is_draft")
|
||||
o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.WORKFLOW), user, peerID, groups, nil).Search(nil, search, isDraft == "true", int64(offset), int64(limit))
|
||||
|
||||
extend := strings.Split(o.Ctx.Input.Query("extend"), ",")
|
||||
s := oclib.NewRequest(oclib.LibDataEnum(oclib.WORKFLOW), user, peerID, groups, nil).Search(nil, search, isDraft == "true", int64(offset), int64(limit))
|
||||
o.Data["json"] = map[string]interface{}{
|
||||
"data": oclib.GetExtends(s.Data, extend...),
|
||||
"code": 200,
|
||||
"err": nil,
|
||||
}
|
||||
o.ServeJSON()
|
||||
}
|
||||
|
||||
@@ -120,6 +126,7 @@ func (o *WorkflowController) Publish() {
|
||||
|
||||
// @Title GetAll
|
||||
// @Description find workflow by workflowid
|
||||
// @Param extend query string false "extend"
|
||||
// @Param is_draft query string false "draft wished"
|
||||
// @Param offset query string false
|
||||
// @Param limit query string false
|
||||
@@ -130,22 +137,38 @@ func (o *WorkflowController) GetAll() {
|
||||
isDraft := o.Ctx.Input.Query("is_draft")
|
||||
offset, _ := strconv.Atoi(o.Ctx.Input.Query("offset"))
|
||||
limit, _ := strconv.Atoi(o.Ctx.Input.Query("limit"))
|
||||
o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.WORKFLOW), user, peerID, groups, nil).LoadAll(isDraft == "true", int64(offset), int64(limit))
|
||||
extend := strings.Split(o.Ctx.Input.Query("extend"), ",")
|
||||
s := oclib.NewRequest(oclib.LibDataEnum(oclib.WORKFLOW), user, peerID, groups, nil).LoadAll(isDraft == "true", int64(offset), int64(limit))
|
||||
o.Data["json"] = map[string]interface{}{
|
||||
"data": oclib.GetExtends(s.Data, extend...),
|
||||
"code": 200,
|
||||
"err": nil,
|
||||
}
|
||||
o.ServeJSON()
|
||||
}
|
||||
|
||||
// @Title Get
|
||||
// @Description find workflow by workflowid
|
||||
// @Param extend query string false "extend"
|
||||
// @Param id path string true "the workflowid you want to get"
|
||||
// @Success 200 {workflow} models.workflow
|
||||
// @router /:id [get]
|
||||
func (o *WorkflowController) Get() {
|
||||
user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
id := o.Ctx.Input.Param(":id")
|
||||
extend := strings.Split(o.Ctx.Input.Query("extend"), ",")
|
||||
caller := tools.NewHTTPCaller(paths) // create a new HTTP caller
|
||||
caller.Disabled = oclib.IsQueryParamsEquals(o.Ctx.Input, "is_remote", true)
|
||||
o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.WORKFLOW), user, peerID, groups, caller).LoadOne(id)
|
||||
|
||||
s := oclib.NewRequest(oclib.LibDataEnum(oclib.WORKFLOW), user, peerID, groups, caller).LoadOne(id)
|
||||
if s.Data != nil {
|
||||
o.Data["json"] = map[string]interface{}{
|
||||
"data": oclib.GetExtend(s.Data, s.Data.Extend(extend...), map[tools.DataType]map[string]interface{}{}),
|
||||
"code": 200,
|
||||
"err": nil,
|
||||
}
|
||||
} else {
|
||||
o.Data["json"] = s
|
||||
}
|
||||
o.ServeJSON()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user