diff --git a/src/routes/api.ts b/src/routes/api.ts index 3d89487..0cef787 100644 --- a/src/routes/api.ts +++ b/src/routes/api.ts @@ -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) router.post('/prices/update', async (_req, res) => { 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) const skuListMap: Record = {}; for (const it of items) {