Add the Healthcare platform backend (phases 13.0–13.7) with Alembic migration revision fix, production deploy script, validation reports, shared UI exports, and loyalty list page client directives so Next.js build succeeds. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1023 B
Python
31 lines
1023 B
Python
"""Delivery audit APIs — Phase 13.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 HealthcareAuditLogRead
|
|
from app.services.audit_service import AuditService
|
|
from shared.security import CurrentUser
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("", response_model=list[HealthcareAuditLogRead])
|
|
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
|
|
)
|