Step 4:评论 / 附件 / 审计日志

This commit is contained in:
Cheng Zhou
2025-12-16 17:02:11 +08:00
parent f3692e1145
commit 31892247bf
69 changed files with 506 additions and 2 deletions
+36
View File
@@ -0,0 +1,36 @@
import uuid
from fastapi import APIRouter, Depends
from sqlalchemy.ext.asyncio import AsyncSession
from app.core.deps import get_db_session, require_study_member
from app.crud import audit as audit_crud
from app.schemas.audit import AuditLogRead
router = APIRouter()
@router.get(
"/",
response_model=list[AuditLogRead],
dependencies=[Depends(require_study_member())],
)
async def list_audit_logs(
study_id: uuid.UUID,
entity_type: str | None = None,
entity_id: uuid.UUID | None = None,
action: str | None = None,
skip: int = 0,
limit: int = 100,
db: AsyncSession = Depends(get_db_session),
) -> list[AuditLogRead]:
logs = await audit_crud.list_logs(
db,
study_id=study_id,
entity_type=entity_type,
entity_id=entity_id,
action=action,
skip=skip,
limit=limit,
)
return list(logs)