comm: swagger doc
This commit is contained in:
234
docs/docs.go
234
docs/docs.go
@@ -1,10 +1,10 @@
|
|||||||
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
// Package docs GENERATED BY SWAG; DO NOT EDIT
|
||||||
// This file was generated by swaggo/swag
|
// This file was generated by swaggo/swag
|
||||||
package docs
|
package docs
|
||||||
|
|
||||||
import "github.com/swaggo/swag"
|
import "github.com/swaggo/swag"
|
||||||
|
|
||||||
const docTemplate_swagger = `{
|
const docTemplate = `{
|
||||||
"schemes": {{ marshal .Schemes }},
|
"schemes": {{ marshal .Schemes }},
|
||||||
"swagger": "2.0",
|
"swagger": "2.0",
|
||||||
"info": {
|
"info": {
|
||||||
@@ -70,7 +70,6 @@ const docTemplate_swagger = `{
|
|||||||
},
|
},
|
||||||
"/article/list": {
|
"/article/list": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Admin can get not published article",
|
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -81,12 +80,60 @@ const docTemplate_swagger = `{
|
|||||||
"Article"
|
"Article"
|
||||||
],
|
],
|
||||||
"summary": "get all articles",
|
"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": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "token",
|
"description": "token",
|
||||||
"name": "Token",
|
"name": "Token",
|
||||||
"in": "header"
|
"in": "header"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"enum": [
|
||||||
|
"published",
|
||||||
|
"notpublished"
|
||||||
|
],
|
||||||
|
"type": "string",
|
||||||
|
"description": "string enums",
|
||||||
|
"name": "published",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -126,14 +173,8 @@ const docTemplate_swagger = `{
|
|||||||
"tags": [
|
"tags": [
|
||||||
"Article"
|
"Article"
|
||||||
],
|
],
|
||||||
"summary": "get all articles",
|
"summary": "get an articles",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "token",
|
|
||||||
"name": "Token",
|
|
||||||
"in": "header"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "id",
|
"description": "id",
|
||||||
@@ -211,7 +252,7 @@ const docTemplate_swagger = `{
|
|||||||
"tags": [
|
"tags": [
|
||||||
"Article"
|
"Article"
|
||||||
],
|
],
|
||||||
"summary": "get all articles",
|
"summary": "publish an articles",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -506,6 +547,34 @@ const docTemplate_swagger = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/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}": {
|
"/user/code/{email}/{code}": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
@@ -601,13 +670,25 @@ const docTemplate_swagger = `{
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/utils.GinResponse"
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/utils.GinResponse"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"data": {
|
||||||
|
"$ref": "#/definitions/models.BackUser"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/user/registers": {
|
"/user/registers/{approved}": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
@@ -623,32 +704,15 @@ const docTemplate_swagger = `{
|
|||||||
"name": "Token",
|
"name": "Token",
|
||||||
"in": "header",
|
"in": "header",
|
||||||
"required": true
|
"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",
|
"type": "string",
|
||||||
"description": "email",
|
"description": "string enums",
|
||||||
"name": "email",
|
"name": "approved",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
@@ -742,7 +806,7 @@ const docTemplate_swagger = `{
|
|||||||
},
|
},
|
||||||
"createUser": {
|
"createUser": {
|
||||||
"description": "文章创建者id",
|
"description": "文章创建者id",
|
||||||
"type": "string"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"isDelete": {
|
"isDelete": {
|
||||||
"description": "删除标志",
|
"description": "删除标志",
|
||||||
@@ -758,7 +822,7 @@ const docTemplate_swagger = `{
|
|||||||
},
|
},
|
||||||
"modifyUser": {
|
"modifyUser": {
|
||||||
"description": "文章最后更新者id",
|
"description": "文章最后更新者id",
|
||||||
"type": "string"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"resume": {
|
"resume": {
|
||||||
"description": "文章简述",
|
"description": "文章简述",
|
||||||
@@ -774,6 +838,58 @@ const docTemplate_swagger = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"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": {
|
"models.ChinaAdd": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -870,6 +986,32 @@ const docTemplate_swagger = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"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": {
|
"models.UserApprove": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -921,6 +1063,12 @@ const docTemplate_swagger = `{
|
|||||||
"phone": {
|
"phone": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"region": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"role": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
"username": {
|
"username": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -939,8 +1087,8 @@ const docTemplate_swagger = `{
|
|||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
|
||||||
// SwaggerInfo_swagger holds exported Swagger Info so clients can modify it
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||||
var SwaggerInfo_swagger = &swag.Spec{
|
var SwaggerInfo = &swag.Spec{
|
||||||
Version: "1.0",
|
Version: "1.0",
|
||||||
Host: "",
|
Host: "",
|
||||||
BasePath: "",
|
BasePath: "",
|
||||||
@@ -948,9 +1096,9 @@ var SwaggerInfo_swagger = &swag.Spec{
|
|||||||
Title: "nCov Tracker",
|
Title: "nCov Tracker",
|
||||||
Description: "",
|
Description: "",
|
||||||
InfoInstanceName: "swagger",
|
InfoInstanceName: "swagger",
|
||||||
SwaggerTemplate: docTemplate_swagger,
|
SwaggerTemplate: docTemplate,
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
swag.Register(SwaggerInfo_swagger.InstanceName(), SwaggerInfo_swagger)
|
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,6 @@
|
|||||||
},
|
},
|
||||||
"/article/list": {
|
"/article/list": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Admin can get not published article",
|
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -71,12 +70,60 @@
|
|||||||
"Article"
|
"Article"
|
||||||
],
|
],
|
||||||
"summary": "get all articles",
|
"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": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "token",
|
"description": "token",
|
||||||
"name": "Token",
|
"name": "Token",
|
||||||
"in": "header"
|
"in": "header"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"enum": [
|
||||||
|
"published",
|
||||||
|
"notpublished"
|
||||||
|
],
|
||||||
|
"type": "string",
|
||||||
|
"description": "string enums",
|
||||||
|
"name": "published",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -116,14 +163,8 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"Article"
|
"Article"
|
||||||
],
|
],
|
||||||
"summary": "get all articles",
|
"summary": "get an articles",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "token",
|
|
||||||
"name": "Token",
|
|
||||||
"in": "header"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "id",
|
"description": "id",
|
||||||
@@ -201,7 +242,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"Article"
|
"Article"
|
||||||
],
|
],
|
||||||
"summary": "get all articles",
|
"summary": "publish an articles",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"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}": {
|
"/user/code/{email}/{code}": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
@@ -591,13 +660,25 @@
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/utils.GinResponse"
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/utils.GinResponse"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"data": {
|
||||||
|
"$ref": "#/definitions/models.BackUser"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/user/registers": {
|
"/user/registers/{approved}": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
@@ -613,32 +694,15 @@
|
|||||||
"name": "Token",
|
"name": "Token",
|
||||||
"in": "header",
|
"in": "header",
|
||||||
"required": true
|
"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",
|
"type": "string",
|
||||||
"description": "email",
|
"description": "string enums",
|
||||||
"name": "email",
|
"name": "approved",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
@@ -732,7 +796,7 @@
|
|||||||
},
|
},
|
||||||
"createUser": {
|
"createUser": {
|
||||||
"description": "文章创建者id",
|
"description": "文章创建者id",
|
||||||
"type": "string"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"isDelete": {
|
"isDelete": {
|
||||||
"description": "删除标志",
|
"description": "删除标志",
|
||||||
@@ -748,7 +812,7 @@
|
|||||||
},
|
},
|
||||||
"modifyUser": {
|
"modifyUser": {
|
||||||
"description": "文章最后更新者id",
|
"description": "文章最后更新者id",
|
||||||
"type": "string"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"resume": {
|
"resume": {
|
||||||
"description": "文章简述",
|
"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": {
|
"models.ChinaAdd": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"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": {
|
"models.UserApprove": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -911,6 +1053,12 @@
|
|||||||
"phone": {
|
"phone": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"region": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"role": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
"username": {
|
"username": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
createUser:
|
createUser:
|
||||||
description: 文章创建者id
|
description: 文章创建者id
|
||||||
type: string
|
type: integer
|
||||||
isDelete:
|
isDelete:
|
||||||
description: 删除标志
|
description: 删除标志
|
||||||
type: integer
|
type: integer
|
||||||
@@ -63,7 +63,7 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
modifyUser:
|
modifyUser:
|
||||||
description: 文章最后更新者id
|
description: 文章最后更新者id
|
||||||
type: string
|
type: integer
|
||||||
resume:
|
resume:
|
||||||
description: 文章简述
|
description: 文章简述
|
||||||
type: string
|
type: string
|
||||||
@@ -74,6 +74,44 @@ definitions:
|
|||||||
description: 文章标题
|
description: 文章标题
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
models.BackUser:
|
||||||
|
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
|
||||||
|
type: object
|
||||||
models.ChinaAdd:
|
models.ChinaAdd:
|
||||||
properties:
|
properties:
|
||||||
confirm:
|
confirm:
|
||||||
@@ -137,6 +175,23 @@ definitions:
|
|||||||
suspect:
|
suspect:
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
models.ListArticle:
|
||||||
|
properties:
|
||||||
|
cover:
|
||||||
|
type: string
|
||||||
|
createTime:
|
||||||
|
type: string
|
||||||
|
modifyTime:
|
||||||
|
type: string
|
||||||
|
resume:
|
||||||
|
type: string
|
||||||
|
tags:
|
||||||
|
type: string
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
models.UserApprove:
|
models.UserApprove:
|
||||||
properties:
|
properties:
|
||||||
email:
|
email:
|
||||||
@@ -170,6 +225,10 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
phone:
|
phone:
|
||||||
type: string
|
type: string
|
||||||
|
region:
|
||||||
|
type: string
|
||||||
|
role:
|
||||||
|
type: integer
|
||||||
username:
|
username:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
@@ -246,10 +305,6 @@ paths:
|
|||||||
- application/json
|
- application/json
|
||||||
description: Admin can get not published article
|
description: Admin can get not published article
|
||||||
parameters:
|
parameters:
|
||||||
- description: token
|
|
||||||
in: header
|
|
||||||
name: Token
|
|
||||||
type: string
|
|
||||||
- description: id
|
- description: id
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
@@ -267,7 +322,7 @@ paths:
|
|||||||
data:
|
data:
|
||||||
$ref: '#/definitions/models.BackArticle'
|
$ref: '#/definitions/models.BackArticle'
|
||||||
type: object
|
type: object
|
||||||
summary: get all articles
|
summary: get an articles
|
||||||
tags:
|
tags:
|
||||||
- Article
|
- Article
|
||||||
/article/{id}/publish:
|
/article/{id}/publish:
|
||||||
@@ -292,19 +347,47 @@ paths:
|
|||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/utils.GinResponse'
|
$ref: '#/definitions/utils.GinResponse'
|
||||||
summary: get all articles
|
summary: publish an articles
|
||||||
tags:
|
tags:
|
||||||
- Article
|
- Article
|
||||||
/article/list:
|
/article/list:
|
||||||
get:
|
get:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: Admin can get not published article
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/definitions/utils.GinResponse'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/models.ListArticle'
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
summary: get all articles
|
||||||
|
tags:
|
||||||
|
- Article
|
||||||
|
/article/list/{published}:
|
||||||
|
get:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
parameters:
|
parameters:
|
||||||
- description: token
|
- description: token
|
||||||
in: header
|
in: header
|
||||||
name: Token
|
name: Token
|
||||||
type: string
|
type: string
|
||||||
|
- description: string enums
|
||||||
|
enum:
|
||||||
|
- published
|
||||||
|
- notpublished
|
||||||
|
in: path
|
||||||
|
name: published
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
@@ -319,7 +402,7 @@ paths:
|
|||||||
$ref: '#/definitions/models.BackArticle'
|
$ref: '#/definitions/models.BackArticle'
|
||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
summary: get all articles
|
summary: get user's articles
|
||||||
tags:
|
tags:
|
||||||
- Article
|
- Article
|
||||||
/statistics/china:
|
/statistics/china:
|
||||||
@@ -435,24 +518,6 @@ paths:
|
|||||||
summary: province statistics
|
summary: province statistics
|
||||||
tags:
|
tags:
|
||||||
- Statistics
|
- 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:
|
/user/approve:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
@@ -500,6 +565,24 @@ paths:
|
|||||||
summary: change user's password
|
summary: change user's password
|
||||||
tags:
|
tags:
|
||||||
- User
|
- User
|
||||||
|
/user/code/{email}:
|
||||||
|
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/code/{email}/{code}:
|
/user/code/{email}/{code}:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
@@ -561,11 +644,16 @@ paths:
|
|||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/utils.GinResponse'
|
allOf:
|
||||||
|
- $ref: '#/definitions/utils.GinResponse'
|
||||||
|
- properties:
|
||||||
|
data:
|
||||||
|
$ref: '#/definitions/models.BackUser'
|
||||||
|
type: object
|
||||||
summary: user register account
|
summary: user register account
|
||||||
tags:
|
tags:
|
||||||
- User
|
- User
|
||||||
/user/registers:
|
/user/registers/{approved}:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
- description: token
|
- description: token
|
||||||
@@ -573,6 +661,14 @@ paths:
|
|||||||
name: Token
|
name: Token
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
- description: string enums
|
||||||
|
enum:
|
||||||
|
- approved
|
||||||
|
- notapproved
|
||||||
|
in: path
|
||||||
|
name: approved
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SaveArticleHandler save an article
|
//SaveArticleHandler save an article
|
||||||
// @Tags Article
|
// @Tags Article
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
@@ -38,21 +38,27 @@ func SaveArticleHandler(c *gin.Context) {
|
|||||||
utils.Succ(c, jsonMap)
|
utils.Succ(c, jsonMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPublishedArticlesHandler get all article
|
//ListPublishedArticlesHandler get all article
|
||||||
// @Tags Article
|
// @Tags Article
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Summary get all articles
|
// @Summary get all articles
|
||||||
// @Description Admin can get not published article
|
// @Success 200 {object} utils.GinResponse{data=[]models.ListArticle}
|
||||||
// @Success 200 {object} utils.GinResponse{data=[]models.BackArticle}
|
|
||||||
// @Router /article/list [get]
|
// @Router /article/list [get]
|
||||||
// @Param Token header string false "token"
|
|
||||||
func ListPublishedArticlesHandler(c *gin.Context) {
|
func ListPublishedArticlesHandler(c *gin.Context) {
|
||||||
// TODO: admin need to show more articles
|
|
||||||
articles := article.ListPublishedArticles()
|
articles := article.ListPublishedArticles()
|
||||||
utils.Succ(c, articles)
|
utils.Succ(c, articles)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ListPublishedArticlesHandler get the user's article
|
||||||
|
// @Tags Article
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Summary get user's articles
|
||||||
|
// @Success 200 {object} utils.GinResponse{data=[]models.BackArticle}
|
||||||
|
// @Router /article/list/{published} [get]
|
||||||
|
// @Param Token header string false "token"
|
||||||
|
// @Param published path string true "string enums" Enums(published, notpublished)
|
||||||
func ListArticlesByUser(c *gin.Context) {
|
func ListArticlesByUser(c *gin.Context) {
|
||||||
published := c.Param("published")
|
published := c.Param("published")
|
||||||
claims := utils.ClaimsFromHeader(c)
|
claims := utils.ClaimsFromHeader(c)
|
||||||
@@ -72,7 +78,7 @@ func ListArticlesByUser(c *gin.Context) {
|
|||||||
utils.Succ(c, articles)
|
utils.Succ(c, articles)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteArticleHandler delete article
|
//DeleteArticleHandler delete article
|
||||||
// @Tags Article
|
// @Tags Article
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
@@ -99,15 +105,14 @@ func DeleteArticleHandler(c *gin.Context) {
|
|||||||
utils.Succ(c, nil)
|
utils.Succ(c, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetArticleHandler get an article
|
//GetArticleHandler get an article
|
||||||
// @Tags Article
|
// @Tags Article
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Summary get all articles
|
// @Summary get an articles
|
||||||
// @Description Admin can get not published article
|
// @Description Admin can get not published article
|
||||||
// @Success 200 {object} utils.GinResponse{data=models.BackArticle}
|
// @Success 200 {object} utils.GinResponse{data=models.BackArticle}
|
||||||
// @Router /article/{id} [get]
|
// @Router /article/{id} [get]
|
||||||
// @Param Token header string false "token"
|
|
||||||
// @Param id path string true "id"
|
// @Param id path string true "id"
|
||||||
func GetArticleHandler(c *gin.Context) {
|
func GetArticleHandler(c *gin.Context) {
|
||||||
id, err := strconv.Atoi(c.Param("id"))
|
id, err := strconv.Atoi(c.Param("id"))
|
||||||
@@ -123,11 +128,11 @@ func GetArticleHandler(c *gin.Context) {
|
|||||||
utils.Succ(c, res)
|
utils.Succ(c, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PublishArticleHandler publish an article
|
//PublishArticleHandler publish an article
|
||||||
// @Tags Article
|
// @Tags Article
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Summary get all articles
|
// @Summary publish an articles
|
||||||
// @Success 200 {object} utils.GinResponse{}
|
// @Success 200 {object} utils.GinResponse{}
|
||||||
// @Router /article/{id}/publish [post]
|
// @Router /article/{id}/publish [post]
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Summary user register account
|
// @Summary user register account
|
||||||
// @Success 200 {object} utils.GinResponse{}
|
// @Success 200 {object} utils.GinResponse{data=models.BackUser}
|
||||||
// @Router /user/register [post]
|
// @Router /user/register [post]
|
||||||
// @Param json body models.UserRegister true "json"
|
// @Param json body models.UserRegister true "json"
|
||||||
func UserRegisterHandler(c *gin.Context) {
|
func UserRegisterHandler(c *gin.Context) {
|
||||||
@@ -72,7 +72,9 @@ func UserLoginHandler(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
token := user.Login(jsonMap)
|
token := user.Login(jsonMap)
|
||||||
if token == "" {
|
if token == "" {
|
||||||
// TODO: change to request error
|
// Login failed reasons as follow:
|
||||||
|
// 1. account or password incorrect
|
||||||
|
// 2. account apply not pass
|
||||||
utils.Succ(c, map[string]interface{}{"msg": "failed"})
|
utils.Succ(c, map[string]interface{}{"msg": "failed"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -87,6 +89,7 @@ func UserLoginHandler(c *gin.Context) {
|
|||||||
// @Success 200 {object} utils.GinResponse{}
|
// @Success 200 {object} utils.GinResponse{}
|
||||||
// @Router /user/registers/{approved} [get]
|
// @Router /user/registers/{approved} [get]
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
|
// @Param approved path string true "string enums" Enums(approved, notapproved)
|
||||||
func ListRegisterUserHandler(c *gin.Context) {
|
func ListRegisterUserHandler(c *gin.Context) {
|
||||||
approved := c.Param("approved")
|
approved := c.Param("approved")
|
||||||
claims := utils.ClaimsFromHeader(c)
|
claims := utils.ClaimsFromHeader(c)
|
||||||
@@ -111,7 +114,7 @@ func ListRegisterUserHandler(c *gin.Context) {
|
|||||||
// @Produce json
|
// @Produce json
|
||||||
// @Summary send verify code
|
// @Summary send verify code
|
||||||
// @Success 200 {object} utils.GinResponse{}
|
// @Success 200 {object} utils.GinResponse{}
|
||||||
// @Router /user/{code} [get]
|
// @Router /user/code/{email} [get]
|
||||||
// @Param email path string true "email"
|
// @Param email path string true "email"
|
||||||
func SendEmailCodeHandler(c *gin.Context) {
|
func SendEmailCodeHandler(c *gin.Context) {
|
||||||
email := c.Param("email")
|
email := c.Param("email")
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
package initialize
|
package initialize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"nCovTrack-Backend/service/statistics"
|
||||||
|
|
||||||
"github.com/robfig/cron/v3"
|
"github.com/robfig/cron/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
func initCron() {
|
func initCron() {
|
||||||
c := cron.New()
|
c := cron.New()
|
||||||
//c.AddFunc("@every 10s", func() { global.Redis.Set("OK", time.Now().String(), time.Duration(10*time.Hour)) })
|
//c.AddFunc("@every 10s", func() { global.Redis.Set("OK", time.Now().String(), time.Duration(10*time.Hour)) })
|
||||||
//c.AddFunc("@every 10m", statistics.CacheNCov)
|
c.AddFunc("@every 10m", statistics.CacheNCov)
|
||||||
c.Start()
|
c.Start()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func initSwagger() {
|
func initSwagger() {
|
||||||
docs.SwaggerInfo_swagger.BasePath = "/api" + global.ServerSettings.UrlPrefix
|
docs.SwaggerInfo.BasePath = "/api" + global.ServerSettings.UrlPrefix
|
||||||
global.RootRouter.GET("/swagger/*any", swagger.WrapHandler(swaggerFile.Handler))
|
global.RootRouter.GET("/swagger/*any", swagger.WrapHandler(swaggerFile.Handler))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,15 +11,17 @@ func ListPublishedArticles() *[]models.ListArticle {
|
|||||||
return listArticles(1, 0)
|
return listArticles(1, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ListPublishedArticlesByUser list the user's published articles
|
||||||
func ListPublishedArticlesByUser(id int) *[]models.ListArticle {
|
func ListPublishedArticlesByUser(id int) *[]models.ListArticle {
|
||||||
return listArticles(1, id)
|
return listArticles(1, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
//ListNotPublishedArticlesByUser list all articles(without not published)
|
//ListNotPublishedArticlesByUser list the user's not publish articles
|
||||||
func ListNotPublishedArticlesByUser(id int) *[]models.ListArticle {
|
func ListNotPublishedArticlesByUser(id int) *[]models.ListArticle {
|
||||||
return listArticles(0, id)
|
return listArticles(0, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//listArticles complex function need to directly use gorm
|
||||||
func listArticles(isPublish int, createUser int) *[]models.ListArticle {
|
func listArticles(isPublish int, createUser int) *[]models.ListArticle {
|
||||||
queryStr := "back_article.is_delete = 0 AND is_publish = " + strconv.Itoa(isPublish)
|
queryStr := "back_article.is_delete = 0 AND is_publish = " + strconv.Itoa(isPublish)
|
||||||
if createUser != 0 {
|
if createUser != 0 {
|
||||||
|
|||||||
@@ -64,9 +64,11 @@ func ListRegister(claims models.TokenClaims) *[]map[string]interface{} {
|
|||||||
if claims.Region == "" {
|
if claims.Region == "" {
|
||||||
// do nothing
|
// do nothing
|
||||||
} else if !strings.Contains(claims.Region, " ") {
|
} else if !strings.Contains(claims.Region, " ") {
|
||||||
|
// Province Admin approve city admin
|
||||||
tx.Where("approver = 0 AND is_delete = 0 AND region LIKE ? AND role = ?", claims.Region+" %", global.ROLE_ID_MAP["ADMIN"])
|
tx.Where("approver = 0 AND is_delete = 0 AND region LIKE ? AND role = ?", claims.Region+" %", global.ROLE_ID_MAP["ADMIN"])
|
||||||
registers = *models.ListByOrm(tx)
|
registers = *models.ListByOrm(tx)
|
||||||
} else {
|
} else {
|
||||||
|
// City Admin approve workers and volunteers
|
||||||
tx.Where("approver = 0 AND is_delete = 0 AND region = ? AND role in ?", claims.Region, []int{global.ROLE_ID_MAP["WORKER"], global.ROLE_ID_MAP["VOLUNTEER"]})
|
tx.Where("approver = 0 AND is_delete = 0 AND region = ? AND role in ?", claims.Region, []int{global.ROLE_ID_MAP["WORKER"], global.ROLE_ID_MAP["VOLUNTEER"]})
|
||||||
registers = *models.ListByOrm(tx)
|
registers = *models.ListByOrm(tx)
|
||||||
}
|
}
|
||||||
@@ -85,6 +87,10 @@ func ListApprovedRegister(claims models.TokenClaims) *[]map[string]interface{} {
|
|||||||
func ApproveRegister(claims models.TokenClaims, email string, pass bool) bool {
|
func ApproveRegister(claims models.TokenClaims, email string, pass bool) bool {
|
||||||
queryMap := []map[string]interface{}{{"email": email}}
|
queryMap := []map[string]interface{}{{"email": email}}
|
||||||
var approver int
|
var approver int
|
||||||
|
// Approver field status:
|
||||||
|
// = 0: not approved
|
||||||
|
// > 0: approver id, and registe successful
|
||||||
|
// < 0: approver id, and registe failed
|
||||||
if pass {
|
if pass {
|
||||||
approver = claims.ID
|
approver = claims.ID
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user