mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-23 13:13:09 +00:00
refactor: 完成多租户架构移除与系统模块重构
1. 移除所有租户相关逻辑:删除租户ID查询参数、租户字段、租户存储相关代码 2. 重构菜单系统:合并platform/system菜单模块,调整菜单作用域为web/app 3. 修复导出接口:统一post请求使用body传参,替换get导出为post 4. 优化权限标识:更新权限路由前缀为module_system 5. 简化菜单过滤逻辑:移除工作区模式判断,直接展示所有菜单 6. 移除租户切换、代签入等无关功能组件与状态 7. 新增用户注册功能与工单导出接口
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, Path, Query, Security
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi.responses import JSONResponse, StreamingResponse
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.common.response import ResponseSchema, SuccessResponse
|
||||
from app.common.response import ResponseSchema, StreamResponse, SuccessResponse
|
||||
from app.core.base_schema import AuthSchema, PageResultSchema, PaginationQueryParam
|
||||
from app.core.dependencies import AuthPermission, db_getter, get_current_user
|
||||
from app.core.router_class import OperationLogRoute
|
||||
from app.utils.common_util import bytes2file_response
|
||||
|
||||
from .schema import (
|
||||
LoginLogDetailOutSchema,
|
||||
@@ -94,3 +95,19 @@ async def delete_operation_log_controller(
|
||||
) -> JSONResponse:
|
||||
await OperationLogService(auth, db).delete(ids=ids)
|
||||
return SuccessResponse(msg="删除操作日志成功")
|
||||
|
||||
|
||||
@LogRouter.post("/operation/export", summary="导出操作日志", dependencies=[Security(AuthPermission(["module_system:log:export"]))])
|
||||
async def export_operation_log_list_controller(
|
||||
auth: Annotated[AuthSchema, Depends(get_current_user)],
|
||||
db: Annotated[AsyncSession, Depends(db_getter)],
|
||||
search: Annotated[OperationLogQueryParam, Body()],
|
||||
) -> StreamingResponse:
|
||||
operation_log_query_result = await OperationLogService(auth, db).get_list(search=search)
|
||||
operation_log_export_result = OperationLogService.export_list(operation_log_list=[item.model_dump() for item in operation_log_query_result])
|
||||
|
||||
return StreamResponse(
|
||||
data=bytes2file_response(operation_log_export_result),
|
||||
media_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
headers={"Content-Disposition": "attachment; filename=operation_log.xlsx"},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user