feat: add Stalker products functionality with filtering, pagination, and purge option

This commit is contained in:
Victor Noguera
2026-05-19 19:37:05 -04:00
parent aed0c11017
commit f6178a665c
6 changed files with 444 additions and 20 deletions

View File

@@ -222,7 +222,7 @@ test("runStalker fetches product offers, filters sellers, and persists storefron
expect(stats.scannedAsins).toBe(1);
expect(stats.sourceAsinsWithMatches).toBe(1);
expect(stats.matchedSellers).toBe(1);
expect(stats.persistedInventoryAsins).toBe(2);
expect(stats.persistedInventoryAsins).toBe(0);
expect(stats.failedAsins).toBe(0);
expect(stats.candidateSellers).toBe(2);
expect(stats.qualifyingSellers).toBe(1);
@@ -253,7 +253,7 @@ test("runStalker fetches product offers, filters sellers, and persists storefron
expect(run.inventory_sellability_checked_asins).toBe(0);
expect(run.inventory_sellability_available_asins).toBe(0);
expect(run.inventory_sellability_excluded_asins).toBe(0);
expect(run.persisted_inventory_asins).toBe(2);
expect(run.persisted_inventory_asins).toBe(0);
const scan = db.query("SELECT * FROM stalker_asin_scans").get() as any;
expect(scan.source_asin).toBe("B000000001");
@@ -267,7 +267,7 @@ test("runStalker fetches product offers, filters sellers, and persists storefron
expect(sellers[0].seller_id).toBe("AQUALIFIED");
expect(sellers[0].rating_count).toBe(12);
expect(sellers[0].storefront_asin_total).toBe(2);
expect(sellers[0].persisted_inventory_sample_count).toBe(2);
expect(sellers[0].persisted_inventory_sample_count).toBe(0);
const asinSellers = db.query("SELECT * FROM stalker_asin_sellers").all() as any[];
expect(asinSellers.length).toBe(1);
@@ -278,8 +278,5 @@ test("runStalker fetches product offers, filters sellers, and persists storefron
const inventory = db
.query("SELECT asin FROM stalker_seller_inventory ORDER BY asin")
.all() as Array<{ asin: string }>;
expect(inventory.map((row) => row.asin)).toEqual([
"B111111111",
"B222222222",
]);
expect(inventory.map((row) => row.asin)).toEqual([]);
});