style: 统一代码格式和字符串引号使用

refactor: 优化代码结构和可读性

feat: 添加http_limit模块实现请求限制功能

fix: 修复异步任务中使用time.sleep的问题

chore: 更新依赖项并添加pytest测试框架

docs: 更新项目描述信息

perf: 优化Redis序列化方式使用JSON替代pickle

test: 添加测试相关配置和依赖
This commit is contained in:
zhangtao
2026-01-17 20:07:25 +08:00
parent 32b8f18b17
commit 1d54dca76c
139 changed files with 4920 additions and 2826 deletions
@@ -19,7 +19,7 @@ DeptRouter = APIRouter(route_class=OperationLogRoute, prefix="/dept", tags=["部
@DeptRouter.get("/tree", summary="查询部门树", description="查询部门树")
async def get_dept_tree_controller(
search: Annotated[DeptQueryParam, Depends()],
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dept:query"]))]
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dept:query"]))],
) -> JSONResponse:
"""
查询部门树
@@ -35,7 +35,9 @@ async def get_dept_tree_controller(
- CustomException: 查询部门树失败时抛出异常。
"""
order_by = [{"order": "asc"}]
result_dict_list = await DeptService.get_dept_tree_service(search=search, auth=auth, order_by=order_by)
result_dict_list = await DeptService.get_dept_tree_service(
search=search, auth=auth, order_by=order_by
)
log.info("查询部门树成功")
return SuccessResponse(data=result_dict_list, msg="查询部门树成功")
@@ -43,7 +45,7 @@ async def get_dept_tree_controller(
@DeptRouter.get("/detail/{id}", summary="查询部门详情", description="查询部门详情")
async def get_obj_detail_controller(
id: Annotated[int, Path(description="部门ID")],
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dept:detail"]))]
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dept:detail"]))],
) -> JSONResponse:
"""
查询部门详情
@@ -66,7 +68,7 @@ async def get_obj_detail_controller(
@DeptRouter.post("/create", summary="创建部门", description="创建部门")
async def create_obj_controller(
data: DeptCreateSchema,
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dept:create"]))]
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dept:create"]))],
) -> JSONResponse:
"""
创建部门
@@ -90,7 +92,7 @@ async def create_obj_controller(
async def update_obj_controller(
data: DeptUpdateSchema,
id: Annotated[int, Path(description="部门ID")],
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dept:update"]))]
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dept:update"]))],
) -> JSONResponse:
"""
修改部门
@@ -114,7 +116,7 @@ async def update_obj_controller(
@DeptRouter.delete("/delete", summary="删除部门", description="删除部门")
async def delete_obj_controller(
ids: Annotated[list[int], Body(description="ID列表")],
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dept:delete"]))]
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dept:delete"]))],
) -> JSONResponse:
"""
删除部门
@@ -134,10 +136,14 @@ async def delete_obj_controller(
return SuccessResponse(msg="删除部门成功")
@DeptRouter.patch("/available/setting", summary="批量修改部门状态", description="批量修改部门状态")
@DeptRouter.patch(
"/available/setting",
summary="批量修改部门状态",
description="批量修改部门状态",
)
async def batch_set_available_obj_controller(
data: BatchSetAvailable,
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dept:patch"]))]
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dept:patch"]))],
) -> JSONResponse:
"""
批量修改部门状态