add: person route
This commit is contained in:
parent
dfd2fd9392
commit
2480e99ac3
|
@ -34,7 +34,7 @@ var doc = `{
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"peple"
|
"people"
|
||||||
],
|
],
|
||||||
"summary": "人员列表",
|
"summary": "人员列表",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"peple"
|
"people"
|
||||||
],
|
],
|
||||||
"summary": "人员列表",
|
"summary": "人员列表",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
|
|
|
@ -73,7 +73,7 @@ paths:
|
||||||
$ref: '#/definitions/model.Person'
|
$ref: '#/definitions/model.Person'
|
||||||
summary: 人员列表
|
summary: 人员列表
|
||||||
tags:
|
tags:
|
||||||
- peple
|
- people
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- multipart/form-data
|
- multipart/form-data
|
||||||
|
|
|
@ -19,7 +19,7 @@ func NewPerson(base *Base) Person {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 人员列表
|
// @Summary 人员列表
|
||||||
// @Tags peple
|
// @Tags people
|
||||||
// @Description 此接口用来获取人员数据列表,支持名称模糊查询,以及自定义排序(name, created_at)
|
// @Description 此接口用来获取人员数据列表,支持名称模糊查询,以及自定义排序(name, created_at)
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
|
|
|
@ -52,6 +52,15 @@ func InitRouter() *gin.Engine {
|
||||||
templates.PATCH("/:id", template.Update)
|
templates.PATCH("/:id", template.Update)
|
||||||
templates.DELETE("/:id", template.Delete)
|
templates.DELETE("/:id", template.Delete)
|
||||||
}
|
}
|
||||||
|
people := apiRouterGroup.Group("/people")
|
||||||
|
person := api.NewPerson(&base)
|
||||||
|
{
|
||||||
|
people.GET("", person.List)
|
||||||
|
people.POST("", person.Create)
|
||||||
|
people.GET("/:id", person.Get)
|
||||||
|
people.PATCH("/:id", person.Update)
|
||||||
|
people.DELETE("/:id", person.Delete)
|
||||||
|
}
|
||||||
|
|
||||||
return Engine
|
return Engine
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue