Add RFM segmentation analytics
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m12s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m12s
This commit is contained in:
@@ -3,7 +3,8 @@ const { verifyToken } = require('../auth');
|
||||
const {
|
||||
getClientAnalytics,
|
||||
getDashboardAnalytics,
|
||||
getProductAnalytics
|
||||
getProductAnalytics,
|
||||
getRfmAnalytics
|
||||
} = require('../services/analyticsService');
|
||||
|
||||
const router = express.Router();
|
||||
@@ -40,4 +41,13 @@ router.get('/analytics/clients', verifyToken, async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/analytics/rfm', verifyToken, async (req, res) => {
|
||||
try {
|
||||
res.json(await getRfmAnalytics(getRange(req.query)));
|
||||
} catch (error) {
|
||||
console.error('Error fetching RFM analytics:', error);
|
||||
res.status(500).json({ error: 'Internal Server Error' });
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
||||
Reference in New Issue
Block a user