diff --git a/packages/api/src/routes/scrapers.ts b/packages/api/src/routes/scrapers.ts index 0f4eea5..92de8b1 100644 --- a/packages/api/src/routes/scrapers.ts +++ b/packages/api/src/routes/scrapers.ts @@ -9,9 +9,9 @@ export const scraperRouter = Router(); const SCRAPERS = [ { name: "fs-com", label: "FS.com", category: "vendor", url: "https://www.fs.com" }, { name: "cisco-tmg", label: "Cisco TMG", category: "vendor", url: "https://tmg.cisco.com" }, - { name: "flexoptix-catalog", label: "Flexoptix Catalog", category: "vendor", url: "https://www.flexoptix.net" }, - { name: "flexoptix-vendors", label: "Flexoptix Vendors", category: "vendor", url: "https://www.flexoptix.net" }, - { name: "flexoptix-supported-vendors", label: "Flexoptix Supported", category: "vendor", url: "https://www.flexoptix.net" }, + { name: "flexoptix-catalog", label: "Flexoptix Catalog", category: "vendor", url: "https://www.flexoptix.net", dbSlug: "flexoptix" }, + { name: "flexoptix-vendors", label: "Flexoptix Vendors", category: "vendor", url: "https://www.flexoptix.net", dbSlug: "flexoptix" }, + { name: "flexoptix-supported-vendors", label: "Flexoptix Supported", category: "vendor", url: "https://www.flexoptix.net", dbSlug: "flexoptix" }, { name: "champion-one", label: "Champion ONE", category: "vendor", url: "https://www.champione.com" }, { name: "fluxlight", label: "Fluxlight", category: "vendor", url: "https://www.fluxlight.com" }, { name: "gbics", label: "GBICS", category: "vendor", url: "https://www.gbics.com" }, @@ -92,13 +92,18 @@ scraperRouter.get("/status", async (_req: Request, res: Response) => { const p = priceStats.rows[0] || {}; const d = dbStats.rows[0] || {}; - const scraperStatus = SCRAPERS.map((s) => ({ - ...s, - records: sourceMap[s.name]?.count || 0, - lastRun: sourceMap[s.name]?.last_updated || null, - firstSeen: sourceMap[s.name]?.first_seen || null, - status: sourceMap[s.name]?.count > 0 ? "active" : "no-data", - })); + const scraperStatus = SCRAPERS.map((s) => { + // dbSlug overrides name for DB lookup (e.g. flexoptix-catalog → flexoptix) + const lookupKey = (s as any).dbSlug || s.name; + const stats = sourceMap[lookupKey]; + return { + ...s, + records: stats?.count || 0, + lastRun: stats?.last_updated || null, + firstSeen: stats?.first_seen || null, + status: (stats?.count || 0) > 0 ? "active" : "no-data", + }; + }); res.json({ success: true,