This commit is contained in:
@@ -174,6 +174,20 @@ router.delete('/items', async (_req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Debug: inspect parsed eBay prices for a given sku
|
||||||
|
router.get('/debug/ebay-prices', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const skuParam = typeof req.query.sku === 'string' ? req.query.sku : '';
|
||||||
|
const norm = normalizeSku(skuParam);
|
||||||
|
if (!norm) return res.status(400).json({ error: 'sku required' });
|
||||||
|
const details = await debugFetchSoldPricesUSDForSku(norm);
|
||||||
|
res.json({ sku: norm, ...details });
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error(err);
|
||||||
|
res.status(500).json({ error: err.message || 'Failed to debug ebay prices' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Update cached prices for all distinct SKUs (on-demand only)
|
// Update cached prices for all distinct SKUs (on-demand only)
|
||||||
router.post('/prices/update', async (_req, res) => {
|
router.post('/prices/update', async (_req, res) => {
|
||||||
try {
|
try {
|
||||||
@@ -222,19 +236,6 @@ router.get('/price-report', async (_req, res) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Debug: inspect parsed eBay prices for a given sku
|
|
||||||
router.get('/debug/ebay-prices', async (req, res) => {
|
|
||||||
try {
|
|
||||||
const skuParam = typeof req.query.sku === 'string' ? req.query.sku : '';
|
|
||||||
const norm = normalizeSku(skuParam);
|
|
||||||
if (!norm) return res.status(400).json({ error: 'sku required' });
|
|
||||||
const details = await debugFetchSoldPricesUSDForSku(norm);
|
|
||||||
res.json({ sku: norm, ...details });
|
|
||||||
} catch (err: any) {
|
|
||||||
console.error(err);
|
|
||||||
res.status(500).json({ error: err.message || 'Failed to debug ebay prices' });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// Build sku list with one description (first encountered)
|
// Build sku list with one description (first encountered)
|
||||||
const skuListMap: Record<string, { sku: string, price: number | null, currency: string, updatedAt: string | null, description: string } > = {};
|
const skuListMap: Record<string, { sku: string, price: number | null, currency: string, updatedAt: string | null, description: string } > = {};
|
||||||
for (const it of items) {
|
for (const it of items) {
|
||||||
|
|||||||
Reference in New Issue
Block a user