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
The asset detail page (frontend/app/(dashboard)/assets/[id]/page.tsx) has a "History" tab that calls GET /assets/:id/history and renders a timeline of all events on the asset. Every create, update, status change, transfer, maintenance event, note, and document upload must be captured.
Context
Frontend: frontend/lib/api/assets.tsgetAssetHistory(id) calls GET /assets/:id/history
GET /assets/:id/history returns paginated history records sorted by createdAt DESC, with user firstName and lastName included (JOIN, not N+1)
Create AssetHistoryService.log(assetId, action, userId, metadata?) as a reusable method called from AssetsService, NotesService, MaintenanceService, DocumentService
Add @Index() on AssetHistory.assetId and AssetHistory.createdAt
Overview
The asset detail page (
frontend/app/(dashboard)/assets/[id]/page.tsx) has a "History" tab that callsGET /assets/:id/historyand renders a timeline of all events on the asset. Every create, update, status change, transfer, maintenance event, note, and document upload must be captured.Context
frontend/lib/api/assets.tsgetAssetHistory(id)callsGET /assets/:id/historyAssetHistoryEvent.actionenum infrontend/lib/query/types/asset.ts:CREATED,UPDATED,STATUS_CHANGED,TRANSFERRED,MAINTENANCE,NOTE_ADDED,DOCUMENT_UPLOADEDAcceptance Criteria
AssetHistoryentity:id(UUID),assetId,action(AssetHistoryActionenum),userId(who performed the action),metadata(JSON — stores before/after values or relevant context),createdAtAssetHistoryActionenum matching the frontend:CREATED,UPDATED,STATUS_CHANGED,TRANSFERRED,MAINTENANCE,NOTE_ADDED,DOCUMENT_UPLOADEDGET /assets/:id/historyreturns paginated history records sorted bycreatedAt DESC, with userfirstNameandlastNameincluded (JOIN, not N+1)AssetHistoryService.log(assetId, action, userId, metadata?)as a reusable method called from AssetsService, NotesService, MaintenanceService, DocumentService@Index()onAssetHistory.assetIdandAssetHistory.createdAt