Add the experience service with sites through analytics/AI hooks, migrations through 0011, and phase docs/manifests marking the track complete. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
"""Experience audit APIs — Phase 11.0."""
|
|
from __future__ import annotations
|
|
|
|
from uuid import UUID
|
|
|
|
from fastapi import APIRouter, Depends, Query
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.api.deps import get_db, require_tenant
|
|
from app.api.permissions import require_permissions
|
|
from app.permissions.definitions import AUDIT_VIEW
|
|
from app.schemas.foundation import ExperienceAuditLogRead
|
|
from app.services.audit_service import AuditService
|
|
from shared.security import CurrentUser
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("", response_model=list[ExperienceAuditLogRead])
|
|
async def list_audit(
|
|
entity_type: str = Query(...),
|
|
entity_id: UUID = Query(...),
|
|
limit: int = Query(default=100, ge=1, le=500),
|
|
tenant_id: UUID = Depends(require_tenant),
|
|
db: AsyncSession = Depends(get_db),
|
|
_user: CurrentUser = Depends(require_permissions(AUDIT_VIEW)),
|
|
):
|
|
return await AuditService(db).list_for_entity(
|
|
tenant_id, entity_type, entity_id, limit=limit
|
|
)
|