oc-workflow update

This commit is contained in:
mr 2024-08-13 11:04:27 +02:00
parent 0a1a93de9b
commit 94255cf815
3 changed files with 27 additions and 3 deletions

View File

@ -40,7 +40,15 @@ func (o *WorkflowController) Put() {
var res map[string]interface{} var res map[string]interface{}
id := o.Ctx.Input.Param(":id") id := o.Ctx.Input.Param(":id")
json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res) json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res)
caller := tools.NewHTTPCaller("", "", "", oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING))+"/oc/booking") caller := tools.NewHTTPCaller(
map[string]map[tools.METHOD]string{
oclib.LibDataEnum(oclib.BOOKING).String(): {
tools.GET: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking/:id",
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking",
tools.PUT: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking",
},
})
data := oclib.UpdateOne(oclib.LibDataEnum(oclib.WORKFLOW), res, id, caller) data := oclib.UpdateOne(oclib.LibDataEnum(oclib.WORKFLOW), res, id, caller)
data.Err += o.SetNATSPub(res, data) data.Err += o.SetNATSPub(res, data)
o.Data["json"] = data o.Data["json"] = data
@ -87,7 +95,14 @@ func (o *WorkflowController) SetNATSPub(res map[string]interface{}, data oclib.L
func (o *WorkflowController) Post() { func (o *WorkflowController) Post() {
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)
caller := tools.NewHTTPCaller("", "", "", oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING))+"/oc/booking") caller := tools.NewHTTPCaller(map[string]map[tools.METHOD]string{
oclib.LibDataEnum(oclib.BOOKING).String(): {
tools.GET: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking/:id",
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking",
tools.PUT: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking",
},
})
data := oclib.StoreOne(oclib.LibDataEnum(oclib.WORKFLOW), res, caller) data := oclib.StoreOne(oclib.LibDataEnum(oclib.WORKFLOW), res, caller)
data.Err += o.SetNATSPub(res, data) data.Err += o.SetNATSPub(res, data)
o.Data["json"] = data o.Data["json"] = data

5
go.mod
View File

@ -5,13 +5,14 @@ go 1.22.0
toolchain go1.22.4 toolchain go1.22.4
require ( require (
cloud.o-forge.io/core/oc-lib v0.0.0-20240813084212-4911e32ec215
github.com/beego/beego/v2 v2.2.2 github.com/beego/beego/v2 v2.2.2
github.com/goraz/onion v0.1.3 github.com/goraz/onion v0.1.3
github.com/nats-io/nats.go v1.36.0
github.com/smartystreets/goconvey v1.7.2 github.com/smartystreets/goconvey v1.7.2
) )
require ( require (
cloud.o-forge.io/core/oc-lib v0.0.0-20240812145458-6fe862a9b58c // indirect
filippo.io/edwards25519 v1.1.0 // indirect filippo.io/edwards25519 v1.1.0 // indirect
github.com/beego/bee/v2 v2.1.0 // indirect github.com/beego/bee/v2 v2.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
@ -50,6 +51,8 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/montanaflynn/stats v0.7.1 // indirect github.com/montanaflynn/stats v0.7.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nats-io/nkeys v0.4.7 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect github.com/prometheus/client_golang v1.19.1 // indirect

6
go.sum
View File

@ -144,6 +144,12 @@ cloud.o-forge.io/core/oc-lib v0.0.0-20240812142802-e51377eeb31b h1:ofVT7etkOVW/B
cloud.o-forge.io/core/oc-lib v0.0.0-20240812142802-e51377eeb31b/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo= cloud.o-forge.io/core/oc-lib v0.0.0-20240812142802-e51377eeb31b/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240812145458-6fe862a9b58c h1:5zrkYMNALJfx+S1n8CxUNkpWq4bsSTDm5PG2hbqSg5k= cloud.o-forge.io/core/oc-lib v0.0.0-20240812145458-6fe862a9b58c h1:5zrkYMNALJfx+S1n8CxUNkpWq4bsSTDm5PG2hbqSg5k=
cloud.o-forge.io/core/oc-lib v0.0.0-20240812145458-6fe862a9b58c/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo= cloud.o-forge.io/core/oc-lib v0.0.0-20240812145458-6fe862a9b58c/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240813075609-e0eb8cd4ad0b h1:yD7Ra8ykixfampNxkuuANvhD0/YaJ/JAOtEv7Coyxow=
cloud.o-forge.io/core/oc-lib v0.0.0-20240813075609-e0eb8cd4ad0b/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240813082955-3962b7c7aa52 h1:za+jN2MkDfi/HCYflXh0ie2hYB4YqHKvZPMC6Op+tNw=
cloud.o-forge.io/core/oc-lib v0.0.0-20240813082955-3962b7c7aa52/go.mod h1:tFM1H8v+lpHt+dTZAhYmYXu3eF+wOEd+HtcOiUbCCvQ=
cloud.o-forge.io/core/oc-lib v0.0.0-20240813084212-4911e32ec215 h1:Ra1RbFC41IFxJa38krCOHqWcTZvHj8W7FDPKcGnDIuw=
cloud.o-forge.io/core/oc-lib v0.0.0-20240813084212-4911e32ec215/go.mod h1:tFM1H8v+lpHt+dTZAhYmYXu3eF+wOEd+HtcOiUbCCvQ=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=