comm: swagger doc

This commit is contained in:
fallen-angle
2022-04-30 11:30:55 +08:00
parent 09b8e8e262
commit 2482141d0f
9 changed files with 538 additions and 128 deletions

View File

@@ -60,7 +60,6 @@
},
"/article/list": {
"get": {
"description": "Admin can get not published article",
"consumes": [
"application/json"
],
@@ -71,12 +70,60 @@
"Article"
],
"summary": "get all articles",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.GinResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.ListArticle"
}
}
}
}
]
}
}
}
}
},
"/article/list/{published}": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Article"
],
"summary": "get user's articles",
"parameters": [
{
"type": "string",
"description": "token",
"name": "Token",
"in": "header"
},
{
"enum": [
"published",
"notpublished"
],
"type": "string",
"description": "string enums",
"name": "published",
"in": "path",
"required": true
}
],
"responses": {
@@ -116,14 +163,8 @@
"tags": [
"Article"
],
"summary": "get all articles",
"summary": "get an articles",
"parameters": [
{
"type": "string",
"description": "token",
"name": "Token",
"in": "header"
},
{
"type": "string",
"description": "id",
@@ -201,7 +242,7 @@
"tags": [
"Article"
],
"summary": "get all articles",
"summary": "publish an articles",
"parameters": [
{
"type": "string",
@@ -496,6 +537,34 @@
}
}
},
"/user/code/{email}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "send verify code",
"parameters": [
{
"type": "string",
"description": "email",
"name": "email",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/utils.GinResponse"
}
}
}
}
},
"/user/code/{email}/{code}": {
"get": {
"produces": [
@@ -591,13 +660,25 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/utils.GinResponse"
"allOf": [
{
"$ref": "#/definitions/utils.GinResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.BackUser"
}
}
}
]
}
}
}
}
},
"/user/registers": {
"/user/registers/{approved}": {
"get": {
"produces": [
"application/json"
@@ -613,32 +694,15 @@
"name": "Token",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/utils.GinResponse"
}
}
}
}
},
"/user/{code}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "send verify code",
"parameters": [
},
{
"enum": [
"approved",
"notapproved"
],
"type": "string",
"description": "email",
"name": "email",
"description": "string enums",
"name": "approved",
"in": "path",
"required": true
}
@@ -732,7 +796,7 @@
},
"createUser": {
"description": "文章创建者id",
"type": "string"
"type": "integer"
},
"isDelete": {
"description": "删除标志",
@@ -748,7 +812,7 @@
},
"modifyUser": {
"description": "文章最后更新者id",
"type": "string"
"type": "integer"
},
"resume": {
"description": "文章简述",
@@ -764,6 +828,58 @@
}
}
},
"models.BackUser": {
"type": "object",
"properties": {
"approver": {
"description": "注册审核人ID",
"type": "integer"
},
"aptitude": {
"description": "用户资质证明(图片URL)",
"type": "string"
},
"createTime": {
"description": "用户注册时间",
"type": "string"
},
"email": {
"description": "用户邮箱",
"type": "string"
},
"id": {
"description": "用户ID",
"type": "integer"
},
"isDelete": {
"description": "删除标志",
"type": "integer"
},
"modifyTime": {
"type": "string"
},
"password": {
"description": "用户密码",
"type": "string"
},
"phone": {
"description": "用户手机号码",
"type": "string"
},
"region": {
"description": "用户所属地域",
"type": "string"
},
"role": {
"description": "用户角色",
"type": "integer"
},
"username": {
"description": "用户真实姓名",
"type": "string"
}
}
},
"models.ChinaAdd": {
"type": "object",
"properties": {
@@ -860,6 +976,32 @@
}
}
},
"models.ListArticle": {
"type": "object",
"properties": {
"cover": {
"type": "string"
},
"createTime": {
"type": "string"
},
"modifyTime": {
"type": "string"
},
"resume": {
"type": "string"
},
"tags": {
"type": "string"
},
"title": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"models.UserApprove": {
"type": "object",
"properties": {
@@ -911,6 +1053,12 @@
"phone": {
"type": "string"
},
"region": {
"type": "string"
},
"role": {
"type": "integer"
},
"username": {
"type": "string"
}