oc-peer/controllers/workflow.go

61 lines
1.6 KiB
Go
Raw Normal View History

2024-07-11 11:40:11 +02:00
package controllers
import (
"fmt"
beego "github.com/beego/beego/v2/server/web"
)
// Operations about workflow
type WorkflowController struct {
beego.Controller
}
// @Title Create
// @Description create workflows
// @Param body body []models.workflow true "The workflow content"
// @Success 200 {string} models.workflow.Id
// @Failure 403 body is empty
// @router / [post]
func (o *WorkflowController) Post() {
// store and return Id or post with UUID
o.Data["json"] = map[string]string{"Id": "?"}
o.ServeJSON()
}
// @Title Get
// @Description find workflow by workflowid
// @Param workflowId path string true "the workflowid you want to get"
// @Success 200 {workflow} models.workflow
// @Failure 403 :workflowId is empty
// @router /:workflowId [get]
func (o *WorkflowController) Get() {
workflowId := o.Ctx.Input.Param(":workflowId")
fmt.Println(workflowId)
o.ServeJSON()
}
// @Title Find
// @Description find workflows with query
// @Param query path string true "the keywords you need"
// @Success 200 {workflows} []models.workflow
// @Failure 403
// @router /find/:query [get]
func (o *WorkflowController) Find() {
query := o.Ctx.Input.Param(":query")
fmt.Println(query)
o.ServeJSON()
}
// @Title Delete
// @Description delete the workflow
// @Param workflowId path string true "The workflowId you want to delete"
// @Success 200 {string} delete success!
// @Failure 403 workflowId is empty
// @router /:workflowId [delete]
func (o *WorkflowController) Delete() {
workflowId := o.Ctx.Input.Param(":workflowId")
fmt.Println(workflowId)
o.ServeJSON()
}