fix: route manufacturing audit logs to shared Postgres audit log
- Manufacturing router now uses shared/audit.log_action (Postgres) instead of the separate manufacturing/audit.py (SQLite mfg_audit_log), so all manufacturing events appear in the Log Viewer - Added log_action calls to 5 previously unlogged endpoints: lifecycle patch, lifecycle create, lifecycle delete, flash asset upload, flash asset note - Removed the now-redundant /manufacturing/audit-log endpoint - Log Viewer restricted to sysadmin only: backend uses require_sysadmin (was require_admin_or_above), frontend adds role guard on the page - Fixed Action badge column clipping: table-layout auto + whiteSpace nowrap so the column sizes to fit the widest badge (Status Change) - Added device_batch entity type to Log Viewer entity labels and filters Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from database.postgres import get_pg_session
|
||||
from shared.orm import AuditLog
|
||||
from auth.dependencies import require_admin_or_above
|
||||
from auth.dependencies import require_sysadmin
|
||||
from auth.models import TokenPayload
|
||||
|
||||
router = APIRouter(prefix="/api/audit-log", tags=["audit-log"])
|
||||
@@ -26,7 +26,7 @@ async def list_audit_log(
|
||||
to_date: Optional[datetime] = Query(None),
|
||||
limit: int = Query(_DEFAULT_LIMIT, ge=1, le=_MAX_LIMIT),
|
||||
offset: int = Query(0, ge=0),
|
||||
_user: TokenPayload = Depends(require_admin_or_above),
|
||||
_user: TokenPayload = Depends(require_sysadmin),
|
||||
db: AsyncSession = Depends(get_pg_session),
|
||||
):
|
||||
filters = []
|
||||
|
||||
Reference in New Issue
Block a user