mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
feat: Add Api Docs
This commit is contained in:
@@ -4,25 +4,28 @@ from apps.datasource.crud.datasource import update_ds_recommended_config
|
||||
from apps.datasource.crud.recommended_problem import get_datasource_recommended, \
|
||||
save_recommended_problem, get_datasource_recommended_base
|
||||
from apps.datasource.models.datasource import RecommendedProblemBase
|
||||
from common.core.deps import SessionDep, CurrentUser
|
||||
from apps.swagger.i18n import PLACEHOLDER_PREFIX
|
||||
from common.audit.models.log_model import OperationType, OperationModules
|
||||
from common.audit.schemas.logger_decorator import LogConfig, system_log
|
||||
from common.core.deps import SessionDep, CurrentUser
|
||||
|
||||
router = APIRouter(tags=["recommended_problem"], prefix="/recommended_problem")
|
||||
router = APIRouter(tags=["recommended problem"], prefix="/recommended_problem")
|
||||
|
||||
|
||||
@router.get("/get_datasource_recommended/{ds_id}")
|
||||
@router.get("/get_datasource_recommended/{ds_id}", response_model=None, summary=f"{PLACEHOLDER_PREFIX}rp_get")
|
||||
async def datasource_recommended(session: SessionDep, ds_id: int):
|
||||
return get_datasource_recommended(session, ds_id)
|
||||
|
||||
@router.get("/get_datasource_recommended_base/{ds_id}")
|
||||
|
||||
@router.get("/get_datasource_recommended_base/{ds_id}", response_model=None, summary=f"{PLACEHOLDER_PREFIX}rp_base")
|
||||
async def datasource_recommended(session: SessionDep, ds_id: int):
|
||||
return get_datasource_recommended_base(session, ds_id)
|
||||
|
||||
|
||||
@router.post("/save_recommended_problem")
|
||||
@router.post("/save_recommended_problem", response_model=None, summary=f"{PLACEHOLDER_PREFIX}rp_save")
|
||||
@system_log(
|
||||
LogConfig(operation_type=OperationType.UPDATE, module=OperationModules.DATASOURCE, resource_id_expr="data_info.datasource_id"))
|
||||
LogConfig(operation_type=OperationType.UPDATE, module=OperationModules.DATASOURCE,
|
||||
resource_id_expr="data_info.datasource_id"))
|
||||
async def datasource_recommended(session: SessionDep, user: CurrentUser, data_info: RecommendedProblemBase):
|
||||
update_ds_recommended_config(session, data_info.datasource_id, data_info.recommended_config)
|
||||
return save_recommended_problem(session, user, data_info)
|
||||
|
||||
@@ -74,9 +74,9 @@ tags_metadata = [
|
||||
"name": "system_authentication",
|
||||
"description": f"{PLACEHOLDER_PREFIX}system_authentication_api"
|
||||
},
|
||||
{ "name": "Table Relation",
|
||||
"description": f"{PLACEHOLDER_PREFIX}tr_api"
|
||||
},
|
||||
{"name": "Table Relation",
|
||||
"description": f"{PLACEHOLDER_PREFIX}tr_api"
|
||||
},
|
||||
{
|
||||
"name": "Data Permission",
|
||||
"description": f"{PLACEHOLDER_PREFIX}per_api"
|
||||
@@ -97,6 +97,14 @@ tags_metadata = [
|
||||
"name": "mcp",
|
||||
"description": f"{PLACEHOLDER_PREFIX}mcp_api"
|
||||
},
|
||||
{
|
||||
"name": "recommended problem",
|
||||
"description": f"{PLACEHOLDER_PREFIX}recommended_problem_api"
|
||||
},
|
||||
{
|
||||
"name": "Audit",
|
||||
"description": f"{PLACEHOLDER_PREFIX}audit_api"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,16 @@
|
||||
|
||||
"mcp_api": "MCP Tools(It is not recommended to call via API)",
|
||||
|
||||
"recommended_problem_api": "Recommended Questions",
|
||||
"rp_save": "Save the question",
|
||||
"rp_get": "Get Recommended Questions",
|
||||
"rp_base": "Obtain recommended queries for data sources",
|
||||
|
||||
"audit_api": "Log Audit",
|
||||
"audit_export": "Export Log Audit",
|
||||
"audit_get_log_page": "Pagination for Log Audit",
|
||||
"audit_get_option": "Retrieve audit configuration",
|
||||
|
||||
"system": "System Management",
|
||||
"system_user_api": "User APIs",
|
||||
"system_user_current_user": "Get Current User",
|
||||
|
||||
@@ -27,6 +27,16 @@
|
||||
|
||||
"mcp_api": "MCP Tools(不建议api方式调用)",
|
||||
|
||||
"recommended_problem_api": "推荐问题",
|
||||
"rp_save": "保存问题",
|
||||
"rp_get": "获取推荐提问",
|
||||
"rp_base": "获取数据源推荐提问",
|
||||
|
||||
"audit_api": "日志审计",
|
||||
"audit_export": "导出日志审计",
|
||||
"audit_get_log_page": "分页获取日志审计",
|
||||
"audit_get_option": "获取审计配置",
|
||||
|
||||
"system": "系统管理",
|
||||
"system_user_api": "用户接口",
|
||||
"system_user_current_user": "查询当前用户",
|
||||
|
||||
Reference in New Issue
Block a user