Initial version, empty shell
This commit is contained in:
19
controllers/version.go
Normal file
19
controllers/version.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// VersionController operations for Version
|
||||
type VersionController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// @Title GetAll
|
||||
// @Description get version
|
||||
// @Success 200
|
||||
// @router / [get]
|
||||
func (c *VersionController) GetAll() {
|
||||
c.Data["json"] = map[string]string{"version": "1"}
|
||||
c.ServeJSON()
|
||||
}
|
||||
60
controllers/workflow.go
Normal file
60
controllers/workflow.go
Normal file
@@ -0,0 +1,60 @@
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user