Files
nCovTrack-Backend/docs/swagger.yaml
2022-05-04 20:06:21 +08:00

775 lines
17 KiB
YAML

definitions:
models.AreaInfo:
properties:
children:
items:
$ref: '#/definitions/models.AreaInfo'
type: array
name:
type: string
parent:
type: string
today:
$ref: '#/definitions/models.AreaToday'
total:
$ref: '#/definitions/models.AreaTotal'
type: object
models.AreaToday:
properties:
confirm:
type: integer
isUpdate:
type: boolean
type: object
models.AreaTotal:
properties:
confirm:
type: integer
dead:
type: integer
heal:
type: integer
nowConfirm:
type: integer
provinceLocalConfirm:
type: integer
showHeal:
type: boolean
showRate:
type: boolean
wzz:
type: integer
type: object
models.BackArticle:
properties:
content:
description: 文章内容(如有需要可迁移至对象存储)
type: string
cover:
description: 文章封面
type: string
createTime:
description: 文章新建时间
type: string
createUser:
description: 文章创建者id
type: integer
isDelete:
description: 删除标志
type: integer
isPublish:
description: '发布状态(0:未发布, 1: 发布)'
type: integer
modifyTime:
description: 文章最后更新时间
type: string
modifyUser:
description: 文章最后更新者id
type: integer
resume:
description: 文章简述
type: string
tags:
description: 文章Tag
type: string
title:
description: 文章标题
type: string
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:
properties:
confirm:
type: integer
dead:
type: integer
heal:
type: integer
importedCase:
type: integer
localConfirm:
type: integer
localConfirmH5:
type: integer
noInfect:
type: integer
noInfectH5:
type: integer
nowConfirm:
type: integer
nowSevere:
type: integer
suspect:
type: integer
type: object
models.ChinaData:
properties:
chinaAdd:
$ref: '#/definitions/models.ChinaAdd'
chinaTotal:
$ref: '#/definitions/models.ChinaTotal'
type: object
models.ChinaDay:
properties:
confirm:
type: integer
date:
type: string
dead:
type: integer
deadRate:
type: string
heal:
type: integer
healRate:
type: string
importedCase:
type: integer
local_acc_confirm:
type: integer
localConfirm:
type: integer
localConfirmH5:
type: integer
noInfect:
type: integer
noInfectH5:
type: integer
nowConfirm:
type: integer
nowSevere:
type: integer
suspect:
type: integer
"y":
type: string
type: object
models.ChinaDayAdd:
properties:
confirm:
type: integer
date:
type: string
dead:
type: integer
deadRate:
type: string
heal:
type: integer
healRate:
type: string
importedCase:
type: integer
infect:
type: integer
localConfirmadd:
type: integer
localinfectionadd:
type: integer
suspect:
type: integer
"y":
type: string
type: object
models.ChinaTotal:
properties:
confirm:
type: integer
dead:
type: integer
heal:
type: integer
importedCase:
type: integer
local_acc_confirm:
type: integer
localConfirm:
type: integer
localConfirmH5:
type: integer
noInfect:
type: integer
noInfectH5:
type: integer
nowConfirm:
type: integer
nowSevere:
type: integer
showLocalConfirm:
type: integer
showlocalinfeciton:
type: integer
suspect:
type: integer
type: object
models.ChinaTrend:
properties:
ChinaDayList:
items:
$ref: '#/definitions/models.ChinaDay'
type: array
chinaDayAddList:
items:
$ref: '#/definitions/models.ChinaDayAdd'
type: array
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:
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
region:
type: string
role:
type: integer
username:
type: string
type: object
utils.GinResponse:
properties:
code:
type: integer
data: {}
msg: {}
type: object
info:
contact: {}
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: 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 an 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: publish an articles
tags:
- Article
/article/list:
get:
consumes:
- application/json
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:
- description: token
in: header
name: Token
type: string
- description: string enums
enum:
- published
- notpublished
in: path
name: published
required: true
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 user's articles
tags:
- Article
/statistics/china:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/utils.GinResponse'
- properties:
data:
$ref: '#/definitions/models.ChinaData'
type: object
summary: china data
tags:
- Statistics
/statistics/china/trend:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/utils.GinResponse'
- properties:
data:
$ref: '#/definitions/models.ChinaTrend'
type: object
summary: china trend
tags:
- Statistics
/statistics/city/{sort}:
get:
parameters:
- description: data sorted by
enum:
- today
- total
- now
- default
in: path
name: sort
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/utils.GinResponse'
- properties:
data:
items:
$ref: '#/definitions/models.AreaInfo'
type: array
type: object
summary: city statistics
tags:
- Statistics
/statistics/country:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/utils.GinResponse'
- properties:
data:
items:
$ref: '#/definitions/models.AreaInfo'
type: array
type: object
summary: country statistics
tags:
- Statistics
/statistics/country/child:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/utils.GinResponse'
- properties:
data:
items:
$ref: '#/definitions/models.AreaInfo'
type: array
type: object
summary: country statistics
tags:
- Statistics
/statistics/province/{sort}:
get:
parameters:
- description: data sorted by
enum:
- today
- total
- now
- default
in: path
name: sort
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/utils.GinResponse'
- properties:
data:
items:
$ref: '#/definitions/models.AreaInfo'
type: array
type: object
summary: province statistics
tags:
- Statistics
/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}:
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}:
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:
allOf:
- $ref: '#/definitions/utils.GinResponse'
- properties:
data:
$ref: '#/definitions/models.BackUser'
type: object
summary: user register account
tags:
- User
/user/registers/{approved}:
get:
parameters:
- description: token
in: header
name: Token
required: true
type: string
- description: string enums
enum:
- approved
- notapproved
in: path
name: approved
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"