post shared

This commit is contained in:
mr 2024-08-30 16:00:49 +02:00
parent 476e3f0beb
commit 06389dfff2

View File

@ -57,9 +57,19 @@ func (o *WorkspaceController) Put() {
// @Success 200 {workspace} models.workspace // @Success 200 {workspace} models.workspace
// @router / [post] // @router / [post]
func (o *WorkspaceController) Post() { func (o *WorkspaceController) Post() {
var paths = map[string]map[tools.METHOD]string{
utils.PEER.String(): { // paths to call to status of peers
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc",
},
utils.WORKSPACE.String(): { // paths to call to delete/update workspace on peer destination
tools.PUT: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workspace/:id",
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workspace/:id",
},
}
caller := tools.NewHTTPCaller(paths) // generate a http caller to send to peer shared workspace
var res map[string]interface{} var res map[string]interface{}
json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res) json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res)
o.Data["json"] = oclib.StoreOne(oclib.LibDataEnum(oclib.WORKSPACE), res) o.Data["json"] = oclib.StoreOne(oclib.LibDataEnum(oclib.WORKSPACE), res, caller)
o.ServeJSON() o.ServeJSON()
} }