调整路由以符合 RESTful 规范,新增 API Token 撤销功能
This commit is contained in:
@@ -158,7 +158,116 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/batch/{batch_id}": {
|
||||
"/admin/api-tokens/{id}/revoke": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "将 API Token 标记为已撤销,使其失效但保留记录",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Admin"
|
||||
],
|
||||
"summary": "撤销 API Token",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Token ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.Response"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/batches": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "分页查询所有文件批次,支持按状态过滤和取件码模糊搜索",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Admin"
|
||||
],
|
||||
"summary": "获取批次列表",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "页码 (默认 1)",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "每页数量 (默认 20)",
|
||||
"name": "page_size",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "状态 (active/expired/deleted)",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "取件码 (模糊搜索)",
|
||||
"name": "pickup_code",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/model.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/admin.ListBatchesResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/batches/{batch_id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
@@ -310,75 +419,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/batches": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"AdminAuth": []
|
||||
}
|
||||
],
|
||||
"description": "分页查询所有文件批次,支持按状态过滤和取件码模糊搜索",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Admin"
|
||||
],
|
||||
"summary": "获取批次列表",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "页码 (默认 1)",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "每页数量 (默认 20)",
|
||||
"name": "page_size",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "状态 (active/expired/deleted)",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "取件码 (模糊搜索)",
|
||||
"name": "pickup_code",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/model.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/admin.ListBatchesResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/login": {
|
||||
"post": {
|
||||
"description": "通过密码换取 JWT Token",
|
||||
@@ -431,130 +471,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/download/batch/{pickup_code}": {
|
||||
"get": {
|
||||
"description": "根据取件码将批次内的所有文件打包为 ZIP 格式一次性下载",
|
||||
"produces": [
|
||||
"application/zip"
|
||||
],
|
||||
"tags": [
|
||||
"Public"
|
||||
],
|
||||
"summary": "批量下载文件",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "取件码",
|
||||
"name": "pickup_code",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "file"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/download/file/{file_id}": {
|
||||
"get": {
|
||||
"description": "根据文件 ID 下载单个文件",
|
||||
"produces": [
|
||||
"application/octet-stream"
|
||||
],
|
||||
"tags": [
|
||||
"Public"
|
||||
],
|
||||
"summary": "下载单个文件",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "文件 ID",
|
||||
"name": "file_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "file"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.Response"
|
||||
}
|
||||
},
|
||||
"410": {
|
||||
"description": "Gone",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/pickup/{pickup_code}": {
|
||||
"get": {
|
||||
"description": "根据取件码获取文件批次详详情和文件列表",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Public"
|
||||
],
|
||||
"summary": "获取批次信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "取件码",
|
||||
"name": "pickup_code",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/model.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/public.PickupResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/upload": {
|
||||
"/api/batches": {
|
||||
"post": {
|
||||
"description": "上传一个或多个文件并创建一个提取批次",
|
||||
"consumes": [
|
||||
@@ -634,7 +551,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/upload/text": {
|
||||
"/api/batches/text": {
|
||||
"post": {
|
||||
"description": "中转一段长文本内容并创建一个提取批次",
|
||||
"consumes": [
|
||||
@@ -691,6 +608,129 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/batches/{pickup_code}": {
|
||||
"get": {
|
||||
"description": "根据取件码获取文件批次详详情和文件列表",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Public"
|
||||
],
|
||||
"summary": "获取批次信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "取件码",
|
||||
"name": "pickup_code",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/model.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/public.PickupResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/batches/{pickup_code}/download": {
|
||||
"get": {
|
||||
"description": "根据取件码将批次内的所有文件打包为 ZIP 格式一次性下载",
|
||||
"produces": [
|
||||
"application/zip"
|
||||
],
|
||||
"tags": [
|
||||
"Public"
|
||||
],
|
||||
"summary": "批量下载文件",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "取件码",
|
||||
"name": "pickup_code",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "file"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/files/{file_id}/download": {
|
||||
"get": {
|
||||
"description": "根据文件 ID 下载单个文件",
|
||||
"produces": [
|
||||
"application/octet-stream"
|
||||
],
|
||||
"tags": [
|
||||
"Public"
|
||||
],
|
||||
"summary": "下载单个文件",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "文件 ID",
|
||||
"name": "file_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "file"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.Response"
|
||||
}
|
||||
},
|
||||
"410": {
|
||||
"description": "Gone",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/model.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
|
||||
Reference in New Issue
Block a user