distributed research fully operationnal
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"oc-catalog/infrastructure"
|
||||
|
||||
oclib "cloud.o-forge.io/core/oc-lib"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
@@ -86,34 +83,3 @@ func (o *ResourceController) Get() {
|
||||
o.Data["json"] = map[string]interface{}{"data": results, "code": 200, "error": ""}
|
||||
o.ServeJSON()
|
||||
}
|
||||
|
||||
// @Title Search Decentralized
|
||||
// @Description find workflow by key word
|
||||
// @Param search path string true "the search you want to get"
|
||||
// @Param is_draft query string false "draft wished"
|
||||
// @Success 200 {workflow} models.workflow
|
||||
// @router /decentralized/:type/search/:search [get]
|
||||
func (o *ResourceController) SearchDecentralized() {
|
||||
user, _, _ := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
||||
search := o.Ctx.Input.Param(":search")
|
||||
t := o.Ctx.Input.Param(":type")
|
||||
b, err := json.Marshal(map[string]string{
|
||||
"search": search,
|
||||
"type": t,
|
||||
})
|
||||
infrastructure.EmitNATS(user, tools.PropalgationMessage{
|
||||
Action: tools.PB_SEARCH,
|
||||
DataType: -1,
|
||||
Payload: b,
|
||||
})
|
||||
if err != nil {
|
||||
o.Data["json"] = map[string]interface{}{
|
||||
"data": nil,
|
||||
"code": 400,
|
||||
"error": err,
|
||||
}
|
||||
o.ServeJSON()
|
||||
return
|
||||
}
|
||||
Websocket(o.Ctx.Request.Context(), user, o.Ctx.ResponseWriter, o.Ctx.Request)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user