Optimize client details with opaque tokens
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m20s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m20s
This commit is contained in:
@@ -2,6 +2,7 @@ const express = require('express');
|
||||
const { verifyToken } = require('../auth');
|
||||
const {
|
||||
getClientAnalytics,
|
||||
getClientDetailsAnalytics,
|
||||
getDashboardAnalytics,
|
||||
getProductAnalytics,
|
||||
getRfmAnalytics
|
||||
@@ -41,6 +42,21 @@ router.get('/analytics/clients', verifyToken, async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/analytics/clients/:clientToken/details', verifyToken, async (req, res) => {
|
||||
try {
|
||||
const details = await getClientDetailsAnalytics(req.params.clientToken, getRange(req.query));
|
||||
if (!details) {
|
||||
res.status(404).json({ error: 'Client not found' });
|
||||
return;
|
||||
}
|
||||
|
||||
res.json(details);
|
||||
} catch (error) {
|
||||
console.error('Error fetching client details analytics:', error);
|
||||
res.status(500).json({ error: 'Internal Server Error' });
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/analytics/rfm', verifyToken, async (req, res) => {
|
||||
try {
|
||||
res.json(await getRfmAnalytics(getRange(req.query)));
|
||||
|
||||
Reference in New Issue
Block a user