初始化项目
This commit is contained in:
46
doc/api/nova-task.api
Normal file
46
doc/api/nova-task.api
Normal file
@@ -0,0 +1,46 @@
|
||||
syntax = "v1"
|
||||
|
||||
@server (
|
||||
prefix: /api/task/v1
|
||||
group: task
|
||||
jwt: Auth
|
||||
)
|
||||
service novatask {
|
||||
@doc "获取任务列表"
|
||||
@handler GetTaskList
|
||||
get /tasks (GetTaskListReq) returns (GetTaskListResp)
|
||||
|
||||
@doc "领取任务奖励"
|
||||
@handler GetTaskReward
|
||||
get /reward/:id (GetTaskRewardReq) returns (GetTaskRewardResp)
|
||||
}
|
||||
|
||||
type GetTaskListReq {
|
||||
CommunityId uint `form:"community_id"`
|
||||
}
|
||||
|
||||
type Task {
|
||||
Id uint `json:"id"`
|
||||
Title string `json:"title"`
|
||||
SubTitle string `json:"sub_title"`
|
||||
Description string `json:"description"`
|
||||
Points int `json:"points"`
|
||||
ButtonText string `json:"button_text"`
|
||||
Type int8 `json:"type"`
|
||||
StartAt string `json:"start_at"`
|
||||
EndAt string `json:"end_at"`
|
||||
Status int8 `json:"status"`
|
||||
}
|
||||
|
||||
type GetTaskListResp {
|
||||
Tasks []Task `json:"tasks"`
|
||||
}
|
||||
|
||||
type GetTaskRewardReq {
|
||||
ID uint `path:"id"`
|
||||
}
|
||||
|
||||
type GetTaskRewardResp {
|
||||
Points int `json:"points"`
|
||||
}
|
||||
|
||||
190
doc/swagger/nova-task.json
Normal file
190
doc/swagger/nova-task.json
Normal file
@@ -0,0 +1,190 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "",
|
||||
"version": ""
|
||||
},
|
||||
"schemes": [
|
||||
"http",
|
||||
"https"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"paths": {
|
||||
"/api/task/v1/reward/{id}": {
|
||||
"get": {
|
||||
"summary": "领取任务奖励",
|
||||
"operationId": "GetTaskReward",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GetTaskRewardResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"task"
|
||||
],
|
||||
"security": [
|
||||
{
|
||||
"apiKey": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/task/v1/tasks": {
|
||||
"get": {
|
||||
"summary": "获取任务列表",
|
||||
"operationId": "GetTaskList",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GetTaskListResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "community_id",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "uint32"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"task"
|
||||
],
|
||||
"consumes": [
|
||||
"multipart/form-data"
|
||||
],
|
||||
"security": [
|
||||
{
|
||||
"apiKey": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"GetTaskListReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"community_id": {
|
||||
"type": "integer",
|
||||
"format": "uint32"
|
||||
}
|
||||
},
|
||||
"title": "GetTaskListReq",
|
||||
"required": [
|
||||
"community_id"
|
||||
]
|
||||
},
|
||||
"GetTaskListResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"tasks": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Task"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": "GetTaskListResp",
|
||||
"required": [
|
||||
"tasks"
|
||||
]
|
||||
},
|
||||
"GetTaskRewardReq": {
|
||||
"type": "object",
|
||||
"title": "GetTaskRewardReq"
|
||||
},
|
||||
"GetTaskRewardResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"points": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"title": "GetTaskRewardResp",
|
||||
"required": [
|
||||
"points"
|
||||
]
|
||||
},
|
||||
"Task": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "uint32"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"sub_title": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"points": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"button_text": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "integer",
|
||||
"format": "int8"
|
||||
},
|
||||
"start_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"end_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "integer",
|
||||
"format": "int8"
|
||||
}
|
||||
},
|
||||
"title": "Task",
|
||||
"required": [
|
||||
"id",
|
||||
"title",
|
||||
"sub_title",
|
||||
"description",
|
||||
"points",
|
||||
"button_text",
|
||||
"type",
|
||||
"start_at",
|
||||
"end_at",
|
||||
"status"
|
||||
]
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
"apiKey": {
|
||||
"type": "apiKey",
|
||||
"description": "Enter JWT Bearer token **_only_**",
|
||||
"name": "Authorization",
|
||||
"in": "header"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user