Register all active platform services and base features in core DB so admin can manage them, add delivery/hospitality/sports-center backend phases, update apps catalog and production deploy tooling. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1019 B
Python
31 lines
1019 B
Python
"""Delivery audit APIs — Phase 10.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 DeliveryAuditLogRead
|
|
from app.services.audit_service import AuditService
|
|
from shared.security import CurrentUser
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("", response_model=list[DeliveryAuditLogRead])
|
|
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
|
|
)
|