mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-27 22:55:59 +00:00
fix: 修复文件下载和删除功能 fix: 修复Redis哈希获取方法返回值类型 fix: 修复权限检查逻辑 perf: 优化部门和服务详情查询性能 perf: 优化角色数据范围显示 style: 清理无用导入和注释 style: 统一CRUD方法命名 docs: 更新main.py中的命令说明 chore: 移动IP定位工具类位置 chore: 更新.gitignore忽略迁移版本文件
47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from typing import Dict, List, Optional, Sequence
|
|
|
|
from app.core.base_crud import CRUDBase
|
|
from ..auth.schema import AuthSchema
|
|
from .model import OperationLogModel
|
|
from .schema import OperationLogCreateSchema
|
|
|
|
|
|
class OperationLogCRUD(CRUDBase[OperationLogModel, OperationLogCreateSchema, OperationLogCreateSchema]):
|
|
"""操作日志数据层"""
|
|
|
|
def __init__(self, auth: AuthSchema) -> None:
|
|
"""初始化操作日志CRUD"""
|
|
self.auth = auth
|
|
super().__init__(model=OperationLogModel, auth=auth)
|
|
|
|
async def create_crud(self, data: OperationLogCreateSchema) -> Optional[OperationLogModel]:
|
|
"""
|
|
创建操作日志记录
|
|
|
|
:param data: 操作日志创建模型
|
|
:return: 操作日志记录
|
|
"""
|
|
return await self.create(data=data)
|
|
|
|
async def get_by_id_crud(self, id: int) -> Optional[OperationLogModel]:
|
|
"""
|
|
根据ID获取操作日志详情
|
|
|
|
:param id: 操作日志ID
|
|
:return: 操作日志记录
|
|
"""
|
|
return await self.get(id=id)
|
|
|
|
async def get_list_crud(self, search: Optional[Dict] = None, order_by: Optional[List[Dict[str, str]]] = None) -> Sequence[OperationLogModel]:
|
|
"""
|
|
获取操作日志列表
|
|
|
|
:param search: 搜索条件
|
|
:param order_by: 排序字段
|
|
:return: 操作日志列表
|
|
"""
|
|
return await self.list(search=search, order_by=order_by)
|
|
|