Skip to content

Commit 320ac73

Browse files
committed
feat: Add Api Docs
1 parent a9b20c2 commit 320ac73

File tree

5 files changed

+43
-10
lines changed

5 files changed

+43
-10
lines changed

backend/apps/datasource/api/table_relation.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
# Date: 2025/9/24
33
from typing import List
44

5-
from fastapi import APIRouter
5+
from fastapi import APIRouter, Path
66

77
from apps.datasource.models.datasource import CoreDatasource
8+
from apps.swagger.i18n import PLACEHOLDER_PREFIX
89
from common.core.deps import SessionDep
910

10-
router = APIRouter(tags=["table_relation"], prefix="/table_relation")
11+
router = APIRouter(tags=["Table Relation"], prefix="/table_relation")
1112

1213

13-
@router.post("/save/{ds_id}")
14-
async def save_relation(session: SessionDep, ds_id: int, relation: List[dict]):
14+
@router.post("/save/{ds_id}", response_model=List[dict], summary=f"{PLACEHOLDER_PREFIX}tr_save")
15+
async def save_relation(session: SessionDep, relation: List[dict],
16+
ds_id: int = Path(..., description=f"{PLACEHOLDER_PREFIX}ds_id")):
1517
ds = session.get(CoreDatasource, ds_id)
1618
if ds:
1719
ds.table_relation = relation
@@ -21,8 +23,8 @@ async def save_relation(session: SessionDep, ds_id: int, relation: List[dict]):
2123
return True
2224

2325

24-
@router.post("/get/{ds_id}")
25-
async def save_relation(session: SessionDep, ds_id: int):
26+
@router.post("/get/{ds_id}", response_model=List[dict], summary=f"{PLACEHOLDER_PREFIX}tr_get")
27+
async def save_relation(session: SessionDep, ds_id: int = Path(..., description=f"{PLACEHOLDER_PREFIX}ds_id")):
2628
ds = session.get(CoreDatasource, ds_id)
2729
if ds:
2830
return ds.table_relation if ds.table_relation else []

backend/apps/mcp/mcp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
tokenUrl=f"{settings.API_V1_STR}/login/access-token"
3434
)
3535

36-
router = APIRouter(tags=["mcp"], prefix="/mcp")
36+
router = APIRouter(tags=["mcp"], prefix="/mcp", include_in_schema=False)
3737

3838

3939
# @router.post("/access_token", operation_id="access_token")

backend/apps/swagger/i18n.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,16 @@ def load_translation(lang: str) -> Dict[str, str]:
4545
{
4646
"name": "Datasource",
4747
"description": f"{PLACEHOLDER_PREFIX}ds_api"
48-
}
48+
},
49+
{
50+
"name": "Table Relation",
51+
"description": f"{PLACEHOLDER_PREFIX}tr_api"
52+
},
53+
{
54+
"name": "Data Permission",
55+
"description": f"{PLACEHOLDER_PREFIX}per_api"
56+
},
57+
4958
]
5059

5160

backend/apps/swagger/locales/en.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,16 @@
2121
"ds_edit_field": "Edit Field Info",
2222
"ds_preview_data": "Preview Data",
2323
"ds_upload_excel": "Upload Excel",
24-
"ds_excel": "File"
24+
"ds_excel": "File",
25+
26+
"per_api": "Data Permission",
27+
"per_save": "Save Permission",
28+
"per_delete": "Delete Permission",
29+
"per_id": "Permission ID",
30+
"per_list": "Get Permission List",
31+
"per_get": "Get Permission Item Info",
32+
33+
"tr_api": "Table Relation",
34+
"tr_save": "Save Table Relation",
35+
"tr_get": "Get Table Relation"
2536
}

backend/apps/swagger/locales/zh.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,16 @@
2121
"ds_edit_field": "编辑字段信息",
2222
"ds_preview_data": "预览数据",
2323
"ds_upload_excel": "上传Excel",
24-
"ds_excel": "文件"
24+
"ds_excel": "文件",
25+
26+
"per_api": "数据权限",
27+
"per_save": "保存权限",
28+
"per_delete": "删除权限",
29+
"per_id": "权限 ID",
30+
"per_list": "获取权限列表",
31+
"per_get": "获取单条权限详情",
32+
33+
"tr_api": "表关联关系",
34+
"tr_save": "保存关联关系",
35+
"tr_get": "查询关联关系"
2536
}

0 commit comments

Comments
 (0)