feat: user & article: dev complete
This commit is contained in:
569
docs/docs.go
569
docs/docs.go
@@ -16,6 +16,228 @@ const docTemplate_swagger = `{
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/article": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Article"
|
||||
],
|
||||
"summary": "save article",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "article",
|
||||
"name": "Article",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.BackArticle"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"name": "Token",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/models.BackArticle"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/article/list": {
|
||||
"get": {
|
||||
"description": "Admin can get not published article",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Article"
|
||||
],
|
||||
"summary": "get all articles",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"name": "Token",
|
||||
"in": "header"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.BackArticle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/article/{id}": {
|
||||
"get": {
|
||||
"description": "Admin can get not published article",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Article"
|
||||
],
|
||||
"summary": "get all articles",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"name": "Token",
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "id",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/models.BackArticle"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Article"
|
||||
],
|
||||
"summary": "delete an article",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"name": "Token",
|
||||
"in": "header",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "id",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/article/{id}/publish": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Article"
|
||||
],
|
||||
"summary": "get all articles",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"name": "Token",
|
||||
"in": "header",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "id",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/statistics/china": {
|
||||
"get": {
|
||||
"produces": [
|
||||
@@ -31,7 +253,7 @@ const docTemplate_swagger = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.GinResponse"
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -76,7 +298,7 @@ const docTemplate_swagger = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.GinResponse"
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -110,7 +332,7 @@ const docTemplate_swagger = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.GinResponse"
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -144,7 +366,7 @@ const docTemplate_swagger = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.GinResponse"
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -192,7 +414,7 @@ const docTemplate_swagger = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.GinResponse"
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -210,6 +432,236 @@ const docTemplate_swagger = `{
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/approve": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "admin approve account, user can use account after approved",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"name": "Token",
|
||||
"in": "header",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "json",
|
||||
"name": "json",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.UserApprove"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/chpwd": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "change user's password",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "json",
|
||||
"name": "json",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.UserChangePwd"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/code/{email}/{code}": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "send verify code",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "email",
|
||||
"name": "email",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "code",
|
||||
"name": "code",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/login": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "user login",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "json",
|
||||
"name": "json",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.UserLogin"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/register": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "user register account",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "json",
|
||||
"name": "json",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.UserRegister"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/registers": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "list register infos, which is to be approved",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"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": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "email",
|
||||
"name": "email",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
@@ -273,6 +725,55 @@ const docTemplate_swagger = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.BackArticle": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content": {
|
||||
"description": "文章内容(如有需要可迁移至对象存储)",
|
||||
"type": "string"
|
||||
},
|
||||
"cover": {
|
||||
"description": "文章封面",
|
||||
"type": "string"
|
||||
},
|
||||
"createTime": {
|
||||
"description": "文章新建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"createUser": {
|
||||
"description": "文章创建者id",
|
||||
"type": "string"
|
||||
},
|
||||
"isDelete": {
|
||||
"description": "删除标志",
|
||||
"type": "integer"
|
||||
},
|
||||
"isPublish": {
|
||||
"description": "发布状态(0:未发布, 1: 发布)",
|
||||
"type": "integer"
|
||||
},
|
||||
"modifyTime": {
|
||||
"description": "文章最后更新时间",
|
||||
"type": "string"
|
||||
},
|
||||
"modifyUser": {
|
||||
"description": "文章最后更新者id",
|
||||
"type": "string"
|
||||
},
|
||||
"resume": {
|
||||
"description": "文章简述",
|
||||
"type": "string"
|
||||
},
|
||||
"tags": {
|
||||
"description": "文章Tag",
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"description": "文章标题",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ChinaAdd": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -369,7 +870,63 @@ const docTemplate_swagger = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.GinResponse": {
|
||||
"models.UserApprove": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"pass": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.UserChangePwd": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"newPassword": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.UserLogin": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"account": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.UserRegister": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"aptitude": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"utils.GinResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
|
||||
@@ -6,6 +6,228 @@
|
||||
"version": "1.0"
|
||||
},
|
||||
"paths": {
|
||||
"/article": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Article"
|
||||
],
|
||||
"summary": "save article",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "article",
|
||||
"name": "Article",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.BackArticle"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"name": "Token",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/models.BackArticle"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/article/list": {
|
||||
"get": {
|
||||
"description": "Admin can get not published article",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Article"
|
||||
],
|
||||
"summary": "get all articles",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"name": "Token",
|
||||
"in": "header"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.BackArticle"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/article/{id}": {
|
||||
"get": {
|
||||
"description": "Admin can get not published article",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Article"
|
||||
],
|
||||
"summary": "get all articles",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"name": "Token",
|
||||
"in": "header"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "id",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/models.BackArticle"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Article"
|
||||
],
|
||||
"summary": "delete an article",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"name": "Token",
|
||||
"in": "header",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "id",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/article/{id}/publish": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Article"
|
||||
],
|
||||
"summary": "get all articles",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"name": "Token",
|
||||
"in": "header",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "id",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/statistics/china": {
|
||||
"get": {
|
||||
"produces": [
|
||||
@@ -21,7 +243,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.GinResponse"
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -66,7 +288,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.GinResponse"
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -100,7 +322,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.GinResponse"
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -134,7 +356,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.GinResponse"
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -182,7 +404,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/models.GinResponse"
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -200,6 +422,236 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/approve": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "admin approve account, user can use account after approved",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"name": "Token",
|
||||
"in": "header",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "json",
|
||||
"name": "json",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.UserApprove"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/chpwd": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "change user's password",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "json",
|
||||
"name": "json",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.UserChangePwd"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/code/{email}/{code}": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "send verify code",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "email",
|
||||
"name": "email",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "code",
|
||||
"name": "code",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/login": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "user login",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "json",
|
||||
"name": "json",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.UserLogin"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/register": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "user register account",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "json",
|
||||
"name": "json",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.UserRegister"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/registers": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"summary": "list register infos, which is to be approved",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "token",
|
||||
"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": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "email",
|
||||
"name": "email",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.GinResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
@@ -263,6 +715,55 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.BackArticle": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content": {
|
||||
"description": "文章内容(如有需要可迁移至对象存储)",
|
||||
"type": "string"
|
||||
},
|
||||
"cover": {
|
||||
"description": "文章封面",
|
||||
"type": "string"
|
||||
},
|
||||
"createTime": {
|
||||
"description": "文章新建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"createUser": {
|
||||
"description": "文章创建者id",
|
||||
"type": "string"
|
||||
},
|
||||
"isDelete": {
|
||||
"description": "删除标志",
|
||||
"type": "integer"
|
||||
},
|
||||
"isPublish": {
|
||||
"description": "发布状态(0:未发布, 1: 发布)",
|
||||
"type": "integer"
|
||||
},
|
||||
"modifyTime": {
|
||||
"description": "文章最后更新时间",
|
||||
"type": "string"
|
||||
},
|
||||
"modifyUser": {
|
||||
"description": "文章最后更新者id",
|
||||
"type": "string"
|
||||
},
|
||||
"resume": {
|
||||
"description": "文章简述",
|
||||
"type": "string"
|
||||
},
|
||||
"tags": {
|
||||
"description": "文章Tag",
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"description": "文章标题",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ChinaAdd": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -359,7 +860,63 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.GinResponse": {
|
||||
"models.UserApprove": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"pass": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.UserChangePwd": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"newPassword": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.UserLogin": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"account": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.UserRegister": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"aptitude": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"utils.GinResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
|
||||
@@ -38,6 +38,42 @@ definitions:
|
||||
wzz:
|
||||
type: integer
|
||||
type: object
|
||||
models.BackArticle:
|
||||
properties:
|
||||
content:
|
||||
description: 文章内容(如有需要可迁移至对象存储)
|
||||
type: string
|
||||
cover:
|
||||
description: 文章封面
|
||||
type: string
|
||||
createTime:
|
||||
description: 文章新建时间
|
||||
type: string
|
||||
createUser:
|
||||
description: 文章创建者id
|
||||
type: string
|
||||
isDelete:
|
||||
description: 删除标志
|
||||
type: integer
|
||||
isPublish:
|
||||
description: '发布状态(0:未发布, 1: 发布)'
|
||||
type: integer
|
||||
modifyTime:
|
||||
description: 文章最后更新时间
|
||||
type: string
|
||||
modifyUser:
|
||||
description: 文章最后更新者id
|
||||
type: string
|
||||
resume:
|
||||
description: 文章简述
|
||||
type: string
|
||||
tags:
|
||||
description: 文章Tag
|
||||
type: string
|
||||
title:
|
||||
description: 文章标题
|
||||
type: string
|
||||
type: object
|
||||
models.ChinaAdd:
|
||||
properties:
|
||||
confirm:
|
||||
@@ -101,7 +137,43 @@ definitions:
|
||||
suspect:
|
||||
type: integer
|
||||
type: object
|
||||
models.GinResponse:
|
||||
models.UserApprove:
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
pass:
|
||||
type: boolean
|
||||
type: object
|
||||
models.UserChangePwd:
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
newPassword:
|
||||
type: string
|
||||
type: object
|
||||
models.UserLogin:
|
||||
properties:
|
||||
account:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
type: object
|
||||
models.UserRegister:
|
||||
properties:
|
||||
aptitude:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
phone:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
utils.GinResponse:
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
@@ -113,6 +185,143 @@ info:
|
||||
title: nCov Tracker
|
||||
version: "1.0"
|
||||
paths:
|
||||
/article:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: article
|
||||
in: body
|
||||
name: Article
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.BackArticle'
|
||||
- description: token
|
||||
in: header
|
||||
name: Token
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.GinResponse'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/models.BackArticle'
|
||||
type: object
|
||||
summary: save article
|
||||
tags:
|
||||
- Article
|
||||
/article/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: token
|
||||
in: header
|
||||
name: Token
|
||||
required: true
|
||||
type: string
|
||||
- description: id
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.GinResponse'
|
||||
summary: delete an article
|
||||
tags:
|
||||
- Article
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Admin can get not published article
|
||||
parameters:
|
||||
- description: token
|
||||
in: header
|
||||
name: Token
|
||||
type: string
|
||||
- description: id
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.GinResponse'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/models.BackArticle'
|
||||
type: object
|
||||
summary: get all articles
|
||||
tags:
|
||||
- Article
|
||||
/article/{id}/publish:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: token
|
||||
in: header
|
||||
name: Token
|
||||
required: true
|
||||
type: string
|
||||
- description: id
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.GinResponse'
|
||||
summary: get all articles
|
||||
tags:
|
||||
- Article
|
||||
/article/list:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Admin can get not published article
|
||||
parameters:
|
||||
- description: token
|
||||
in: header
|
||||
name: Token
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.GinResponse'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/models.BackArticle'
|
||||
type: array
|
||||
type: object
|
||||
summary: get all articles
|
||||
tags:
|
||||
- Article
|
||||
/statistics/china:
|
||||
get:
|
||||
produces:
|
||||
@@ -122,7 +331,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/models.GinResponse'
|
||||
- $ref: '#/definitions/utils.GinResponse'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/models.ChinaData'
|
||||
@@ -149,7 +358,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/models.GinResponse'
|
||||
- $ref: '#/definitions/utils.GinResponse'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
@@ -168,7 +377,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/models.GinResponse'
|
||||
- $ref: '#/definitions/utils.GinResponse'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
@@ -187,7 +396,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/models.GinResponse'
|
||||
- $ref: '#/definitions/utils.GinResponse'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
@@ -216,7 +425,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/models.GinResponse'
|
||||
- $ref: '#/definitions/utils.GinResponse'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
@@ -226,4 +435,152 @@ paths:
|
||||
summary: province statistics
|
||||
tags:
|
||||
- Statistics
|
||||
/user/{code}:
|
||||
get:
|
||||
parameters:
|
||||
- description: email
|
||||
in: path
|
||||
name: email
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.GinResponse'
|
||||
summary: send verify code
|
||||
tags:
|
||||
- User
|
||||
/user/approve:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: token
|
||||
in: header
|
||||
name: Token
|
||||
required: true
|
||||
type: string
|
||||
- description: json
|
||||
in: body
|
||||
name: json
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.UserApprove'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.GinResponse'
|
||||
summary: admin approve account, user can use account after approved
|
||||
tags:
|
||||
- User
|
||||
/user/chpwd:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: json
|
||||
in: body
|
||||
name: json
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.UserChangePwd'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.GinResponse'
|
||||
summary: change user's password
|
||||
tags:
|
||||
- User
|
||||
/user/code/{email}/{code}:
|
||||
get:
|
||||
parameters:
|
||||
- description: email
|
||||
in: path
|
||||
name: email
|
||||
required: true
|
||||
type: string
|
||||
- description: code
|
||||
in: path
|
||||
name: code
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.GinResponse'
|
||||
summary: send verify code
|
||||
tags:
|
||||
- User
|
||||
/user/login:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: json
|
||||
in: body
|
||||
name: json
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.UserLogin'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.GinResponse'
|
||||
summary: user login
|
||||
tags:
|
||||
- User
|
||||
/user/register:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: json
|
||||
in: body
|
||||
name: json
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.UserRegister'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.GinResponse'
|
||||
summary: user register account
|
||||
tags:
|
||||
- User
|
||||
/user/registers:
|
||||
get:
|
||||
parameters:
|
||||
- description: token
|
||||
in: header
|
||||
name: Token
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.GinResponse'
|
||||
summary: list register infos, which is to be approved
|
||||
tags:
|
||||
- User
|
||||
swagger: "2.0"
|
||||
|
||||
Reference in New Issue
Block a user