Support Tiny Olist V3 product compositions
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m57s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m57s
This commit is contained in:
@@ -10,6 +10,7 @@ const {
|
||||
getProductDetailsAnalytics,
|
||||
getRfmAnalytics
|
||||
} = require('../services/analyticsService');
|
||||
const { getProductComposition } = require('../services/productionOrderService');
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
@@ -58,6 +59,16 @@ router.get('/analytics/products/:productId/details', verifyToken, async (req, re
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/analytics/products/:productId/composition', verifyToken, async (req, res) => {
|
||||
try {
|
||||
const composition = await getProductComposition(req.params.productId);
|
||||
res.json({ composition });
|
||||
} catch (error) {
|
||||
console.error('Error fetching product composition:', error);
|
||||
res.status(500).json({ error: 'Internal Server Error' });
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/analytics/clients', verifyToken, async (req, res) => {
|
||||
try {
|
||||
res.json(await getClientAnalytics(getClientAnalyticsFilters(req.query)));
|
||||
|
||||
Reference in New Issue
Block a user