30 lines
946 B
JavaScript
30 lines
946 B
JavaScript
'use strict';
|
|
|
|
module.exports = function (app) {
|
|
const router = require('express').Router();
|
|
const ctl = require('../controllers/dashboard');
|
|
|
|
/**
|
|
* Pilot analytics dashboard endpoints.
|
|
* All routes require a valid JWT (enforced by the global checkUser middleware).
|
|
* Data is always scoped to the authenticated user — pilotId is derived from req.uid.
|
|
*/
|
|
|
|
// KPI summary cards
|
|
router.get('/pilot/kpi', ctl.getKpi);
|
|
|
|
// Daily summary: today vs yesterday with percentage deltas
|
|
router.get('/pilot/summary', ctl.getSummary);
|
|
|
|
// Trend charts: daily hours flown + hectares sprayed over a date range
|
|
router.get('/pilot/trend', ctl.getTrend);
|
|
|
|
// Active jobs panel with per-job progress and applied volume
|
|
router.get('/pilot/activeJobs', ctl.getActiveJobs);
|
|
|
|
// Performance gauges: average XT error and spray altitude
|
|
router.get('/pilot/performance', ctl.getPerformance);
|
|
|
|
app.use('/api/dashboard', router);
|
|
};
|