fix(scrapers): Flexoptix Catalog zeigt 0 records statt 963
SCRAPERS list used 'flexoptix-catalog' as DB lookup key but vendors.slug is 'flexoptix' — no match → 0 records shown. Fix: added dbSlug override field to SCRAPERS entries; lookup now uses dbSlug || name so flexoptix-catalog/vendors/supported all map to the correct 'flexoptix' slug in sourceMap.
This commit is contained in:
parent
c509251109
commit
1e789f67eb
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user