feat:fe-issues 02-03-04-05-maintenance, locations, licenses, audits - #1250
Conversation
|
@Diggardson270 is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Diggardson270 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
yusuftomilola
left a comment
There was a problem hiding this comment.
Approving. Solid chunk of work: new Audits module (session/item entities + service + controller), License seat-assignment support, Locations and Maintenance CRUD DTOs/services, plus matching frontend pages for audits, licenses, locations, and maintenance with query hooks. Structure mirrors existing backend modules and the frontend follows the existing app-router/query-hook pattern. Note for the record: CI is currently red on this branch (lint, build, and test-suite jobs failing across backend and frontend) - merging anyway per repo admin decision, but please treat the CI failures as a priority fast-follow.
Summary
Adds four ITAM screens that were missing from AssetsUp — hierarchical Locations, global Maintenance, Licenses & Subscriptions, and Audits/Stocktake — each with the paired backend module, following the repo's existing conventions (typed API clients in
lib/api/, TanStack Query hooks inlib/query/hooks/, keys inlib/query/keys.ts, sharedcomponents/ui/primitives, sidebar entries).Issues
Closes #1090
Closes #1091
Closes #1092
Closes #1093
What's included
[FE-03] Locations & Branches (#1091)
LocationsModule(backend) now returns each location with a directassetCountand a rolled-uptotalAssetCountcomputed from the parent/child tree, and blocks deletes with a clear message when a location still has assets or child locations./locationspage: expandable tree (unlimited depth), create/rename/move (with cycle protection so you can't move a node under its own descendant), delete guard surfaced from the API, and clicking a node filters straight into/assets?locationId=....locationIdrelation, while the legacy free-textlocationfield is kept for migration.[FE-02] Global Maintenance (#1090)
MaintenanceModule(backend) gained atypefield (PREVENTIVE/CORRECTIVE/SCHEDULED), query filters (status,type,departmentId,from,to) onGET /maintenance, and nestedassets/:id/maintenanceroutes so the existing per-asset tab and the new global page read/write the same records./maintenancepage: kanban board (dnd-kit drag-to-change-status with optimistic update + rollback on API error) and a month calendar view, both driven by the same filter bar (type, department, date range). Overdue scheduled items are flagged. A "New Maintenance" modal lets you schedule work for any asset from this page.[FE-05] Licenses & Subscriptions (#1093)
LicensesModule(backend) gained aLicenseSeatAssignmententity (assign/unassign with seat-limit + duplicate-seat guards), a billing period + notes field, and an explicitPOST /licenses/:id/reveal-keyendpoint — the key is never returned by the default list/detail responses (select: falseon the column)./licensespage: table with seat progress bars and renewal-soon highlighting (within 30 days), create/edit modal, and a detail drawer for click-to-reveal license key and seat assign/unassign (blocked once seats are full).[FE-04] Audits / Stocktake (#1092)
AuditsModule(backend):AuditSession+AuditItementities. Creating a session snapshots every asset matching the chosen department/location scope into a PENDING checklist; recording an item result flips the session toIN_PROGRESS;POST /audits/:id/completefinalizes it and every mutating endpoint rejects further edits once a session isCOMPLETED./auditspage: sessions list with progress %, a start wizard (name + department/location scope), and/audits/[id]execution view — checklist with Found/Missing/Wrong Location/Damaged + note, a search box to find an asset quickly, and a completion summary with a discrepancy report exportable as CSV.components/ui/csv.tsx, which had accidentally been left containing a duplicate ofTopbarinstead of the CSV helper the tickets reference — it's now a realtoCsv/downloadCsv/CsvExportButtonutility used by the audit discrepancy export.Backend routes added/changed
GET/POST /locations,GET/PATCH/DELETE /locations/:id(all updated)GET/POST /licenses,GET/PATCH/DELETE /licenses/:id,POST /licenses/:id/reveal-key,GET /licenses/:id/assignments,POST /licenses/:id/assign,POST /licenses/:id/assignments/:assignmentId/unassignGET/POST /maintenance,GET/PATCH /maintenance/:id(filters added),GET/POST /assets/:id/maintenance,PATCH /assets/:id/maintenance/:maintenanceId(new)GET/POST /audits,GET /audits/:id,PATCH /audits/:id/items/:itemId,POST /audits/:id/complete(all new)Acceptance criteria checked
totalSeatsblocked ✅, renewal within 30 days flagged ✅, seat assignments show holder ✅, key never rendered by default ✅Test plan
backend:npm run buildandnpm testpass (31/31, including 3 pre-existing spec files updated for the new constructor signatures)frontend:npx tsc --noEmitand targetedeslinton all touched/added files are cleanPre-existing issues observed (not introduced by this PR, left alone as out of scope)
frontend:next buildandnpm testwere already failing onmainbefore this change — a type mismatch inapp/(dashboard)/dashboard/page.tsx(ReportsSummaryvsWidgetRendererprops) blocks the production build, and__tests__/dashboard.test.tsx/ thee2e/*.spec.tsfiles underjestare missing jest-dom/playwright wiring. Verified viagit diff main -- <file>that this PR touches none of those files.frontend/features/LocationsManagement/*is a pre-existing, unrouted placeholder scaffold (not wired to any page) — left untouched since removing it is out of scope for this PR.