Initial commit

This commit is contained in:
ycc
2023-03-07 13:29:08 +01:00
parent 82b69faa5f
commit 590d655d58
32 changed files with 2114 additions and 4 deletions

37
controllers/identity.go Normal file
View File

@@ -0,0 +1,37 @@
package controllers
import (
"encoding/json"
"oc-discovery/models"
beego "github.com/beego/beego/v2/server/web"
)
// Operations about Identitys
type IdentityController struct {
beego.Controller
}
// @Title CreateIdentity
// @Description create identitys
// @Param body body models.Identity true "body for identity content"
// @Success 200 {int} models.Identity.Id
// @Failure 403 body is empty
// @router / [post]
func (u *IdentityController) Post() {
var identity models.Identity
json.Unmarshal(u.Ctx.Input.RequestBody, &identity)
id := models.UpdateIdentity(&identity)
u.Data["json"] = id
u.ServeJSON()
}
// @Title Get
// @Description get Identity
// @Success 200 {object} models.Identity
// @router / [get]
func (u *IdentityController) GetAll() {
identity := models.GetIdentity()
u.Data["json"] = identity
u.ServeJSON()
}