You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While AssetHistory records exist for asset-level changes, there is no unified audit trail covering all entity types (users, departments, roles, locations). Compliance and security teams need a single endpoint to query what changed, who changed it, and when.
Context
An AuditLog entity may partially exist from prior PRs — verify before creating a new one
Every write operation across all modules should append an audit record
The endpoint must support pagination and multiple filter dimensions simultaneously
Overview
While
AssetHistoryrecords exist for asset-level changes, there is no unified audit trail covering all entity types (users, departments, roles, locations). Compliance and security teams need a single endpoint to query what changed, who changed it, and when.Context
AuditLogentity may partially exist from prior PRs — verify before creating a new oneAcceptance Criteria
AuditLogentity:id,entityType(e.g.,asset,user,department),entityId,action(CREATED,UPDATED,DELETED,STATUS_CHANGED,ROLE_CHANGED),actorId(FK → User),previousValue(JSON),newValue(JSON),ipAddress,userAgent,createdAtAuditService.log()method and call it fromAssetsService,UsersService,DepartmentsService, andAuthServiceon every mutating operationGET /audit-logs(ADMIN only): accepts query params —entityType,entityId,actorId,action,from(date),to(date),page,limitGET /audit-logs/:id— returns full detail of a single log entry including the JSON difffirstNameandlastName(not just ID)