数据导出

This commit is contained in:
ryan
2026-06-09 21:12:39 +08:00
parent 0ead6348f6
commit 05ef5ed7bd
13 changed files with 604 additions and 4 deletions
+106
View File
@@ -455,6 +455,98 @@ const docTemplate = `{
}
}
},
"/api/v1/admin/db-export": {
"get": {
"security": [
{
"SessionCookie": []
}
],
"description": "SQLite 时直接下载 .db 文件;PostgreSQL 时执行 pg_dump 并流式下载 .sql 文件,需要管理员权限",
"produces": [
"application/octet-stream"
],
"tags": [
"admin"
],
"summary": "导出数据库",
"responses": {
"200": {
"description": "数据库文件",
"schema": {
"type": "file"
}
},
"401": {
"description": "未登录",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"403": {
"description": "无管理员权限",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"500": {
"description": "导出失败",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
}
}
}
},
"/api/v1/admin/db-info": {
"get": {
"security": [
{
"SessionCookie": []
}
],
"description": "返回当前使用的数据库类型(sqlite/postgres)、名称/路径及版本字符串,需要管理员权限",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "获取数据库信息",
"responses": {
"200": {
"description": "获取成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/util.ResponseAny"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/status.DatabaseInfoResponse"
}
}
}
]
}
},
"401": {
"description": "未登录",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"403": {
"description": "无管理员权限",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
}
}
}
},
"/api/v1/admin/logs": {
"get": {
"security": [
@@ -4353,6 +4445,20 @@ const docTemplate = `{
}
}
},
"status.DatabaseInfoResponse": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"status.SystemStatusResponse": {
"type": "object",
"properties": {
+106
View File
@@ -448,6 +448,98 @@
}
}
},
"/api/v1/admin/db-export": {
"get": {
"security": [
{
"SessionCookie": []
}
],
"description": "SQLite 时直接下载 .db 文件;PostgreSQL 时执行 pg_dump 并流式下载 .sql 文件,需要管理员权限",
"produces": [
"application/octet-stream"
],
"tags": [
"admin"
],
"summary": "导出数据库",
"responses": {
"200": {
"description": "数据库文件",
"schema": {
"type": "file"
}
},
"401": {
"description": "未登录",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"403": {
"description": "无管理员权限",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"500": {
"description": "导出失败",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
}
}
}
},
"/api/v1/admin/db-info": {
"get": {
"security": [
{
"SessionCookie": []
}
],
"description": "返回当前使用的数据库类型(sqlite/postgres)、名称/路径及版本字符串,需要管理员权限",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "获取数据库信息",
"responses": {
"200": {
"description": "获取成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/util.ResponseAny"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/status.DatabaseInfoResponse"
}
}
}
]
}
},
"401": {
"description": "未登录",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"403": {
"description": "无管理员权限",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
}
}
}
},
"/api/v1/admin/logs": {
"get": {
"security": [
@@ -4346,6 +4438,20 @@
}
}
},
"status.DatabaseInfoResponse": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"status.SystemStatusResponse": {
"type": "object",
"properties": {
+64
View File
@@ -485,6 +485,15 @@ definitions:
user:
$ref: '#/definitions/oauth.BasicUserInfo'
type: object
status.DatabaseInfoResponse:
properties:
name:
type: string
type:
type: string
version:
type: string
type: object
status.SystemStatusResponse:
properties:
alloc:
@@ -1169,6 +1178,61 @@ paths:
summary: 切换认证源启用状态
tags:
- admin
/api/v1/admin/db-export:
get:
description: SQLite 时直接下载 .db 文件;PostgreSQL 时执行 pg_dump 并流式下载 .sql 文件,需要管理员权限
produces:
- application/octet-stream
responses:
"200":
description: 数据库文件
schema:
type: file
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
"500":
description: 导出失败
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 导出数据库
tags:
- admin
/api/v1/admin/db-info:
get:
description: 返回当前使用的数据库类型(sqlite/postgres)、名称/路径及版本字符串,需要管理员权限
produces:
- application/json
responses:
"200":
description: 获取成功
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
$ref: '#/definitions/status.DatabaseInfoResponse'
type: object
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无管理员权限
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 获取数据库信息
tags:
- admin
/api/v1/admin/logs:
get:
description: 分页获取系统历史日志,cursor=0 获取最新日志,cursor>0 获取更早日志