This commit is contained in:
mr 2024-08-13 14:35:53 +02:00
parent 8f3ffd2348
commit 6f0b1ffcf4
2 changed files with 13 additions and 4 deletions

View File

@ -8,7 +8,7 @@ import (
oclib "cloud.o-forge.io/core/oc-lib"
"cloud.o-forge.io/core/oc-lib/models/utils"
w "cloud.o-forge.io/core/oc-lib/models/workflow"
tools "cloud.o-forge.io/core/oc-lib/tools"
"cloud.o-forge.io/core/oc-lib/tools"
beego "github.com/beego/beego/v2/server/web"
"github.com/nats-io/nats.go"
)
@ -39,7 +39,8 @@ func (o *WorkflowController) Search() {
func (o *WorkflowController) Put() {
var paths = map[string]map[tools.METHOD]string{
utils.BOOKING.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking/",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking/",
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking/:id",
},
}
// store and return Id or post with UUID
@ -93,7 +94,8 @@ func (o *WorkflowController) SetNATSPub(res map[string]interface{}, data oclib.L
func (o *WorkflowController) Post() {
var paths = map[string]map[tools.METHOD]string{
utils.BOOKING.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking/",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking/",
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking/:id",
},
}
var res map[string]interface{}
@ -147,8 +149,15 @@ func (o *WorkflowController) Get() {
// @Success 200 {string} delete success!
// @router /:id [delete]
func (o *WorkflowController) Delete() {
var paths = map[string]map[tools.METHOD]string{
utils.BOOKING.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking/",
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.BOOKING)) + "/oc/booking/:id",
},
}
id := o.Ctx.Input.Param(":id")
o.Data["json"] = oclib.DeleteOne(oclib.LibDataEnum(oclib.WORKFLOW), id)
caller := tools.NewHTTPCaller(paths)
o.Data["json"] = oclib.DeleteOne(oclib.LibDataEnum(oclib.WORKFLOW), id, caller)
o.ServeJSON()
}

Binary file not shown.