TrackMe API Docs
Admin

Dashboard & Navigation

Role-scoped dashboard widgets, realtime reload behavior, sidebar groups, and queue badge semantics.

GET /admin/dashboard renders the React dashboard. GET /api/v1/admin/dashboard/snapshot returns the same role-scoped view as JSON. Both use the shared contract in shared/admin/dashboard.ts.

Time ranges

The dashboard accepts exactly three ranges: 7, 30, or 90 days. The server defaults to 30.

Role sections

Dashboard data is scoped by section, not just by page visibility:

RoleSections
super_adminusers, trucks, jobs, marketplace, reviews, reports, orders, revenue
adminusers, trucks, jobs, marketplace, reviews, reports, orders, revenue
content_managerusers, trucks, jobs, marketplace, reviews
support_agentusers, reports, orders
moderatorreports, reviews, trucks, jobs, marketplace

If a section is not in scope, the server does not ship that widget payload. The React page renders widgets only when the prop exists.

Dashboard payload

The snapshot includes:

FieldScope
days, scope, assembledAtAlways present.
metrics, deltasRole-scoped overview KPIs.
userGrowth, recentUsers, activeSessionsCountUsers/system.
recentTrucks, topTrucks, truckJobActivityTrucks/jobs.
recentReports, highPriorityPendingReportsReports.
recentReviews, lowRatedReviewsInWindowReviews.
orderVolume, orderStatusMixOrders.
revenue, refundsRevenue.
marketplaceDistribution, listingActivityMarketplace.
jobApplicationStatusMixJobs.
queueHealthQueue/system health.

assembledAt tells the UI when the server finished assembling the snapshot. Metrics use a 60-second cache, with targeted invalidation for important admin events.

Realtime reloads

The dashboard subscribes to admin broadcast channels for stats and alerts. Events such as order creation/transition, job activity, review creation, report creation, truck publishing, and payment/refund changes trigger partial Inertia reloads for only the affected props.

The important client rule: treat realtime events as invalidation signals. Re-read the server props; do not apply business-state transitions locally from an event payload.

The sidebar is declared in inertia/shell/sidebar-nav-config.ts.

GroupItems
OverviewDashboard
OperateUsers, Trucks, Categories, Jobs, Marketplace
ModerateReviews, Reports, Menu, Support
CommercePricing, Payments, Analytics, Refunds, Webhooks, Orders
SystemAdmins, Announcements, Notifications, Activity, Security, Queue, Legal, FAQs, About, Settings

An item can be gated by a dashboard section, by an explicit role allow-list, or both. Detail pages inherit their parent nav item, so /admin/users/:id still highlights Users.

BadgeCount semantics
ReportsReports with status in ("pending", "new"). This covers the current mobile contract and legacy reports, and matches the dashboard pending-reports KPI.
SupportSupport tickets with status in ("open", "pending"). assigned is excluded because someone already owns it.

Counts are role-scoped. An out-of-scope badge is null, not 0, so the UI can distinguish "no access" from "empty queue".

On this page