feat: enhance Stalker functionality with additional product details and analysis capabilities

This commit is contained in:
Victor Noguera
2026-05-19 19:57:53 -04:00
parent f6178a665c
commit 0552d183b3
7 changed files with 795 additions and 26 deletions

View File

@@ -419,6 +419,16 @@ export function initStalkerDb(database: Database): void {
can_sell INTEGER,
sellability_status TEXT,
sellability_reason TEXT,
product_title TEXT,
brand TEXT,
category_tree TEXT,
current_price REAL,
avg_price_90d REAL,
sales_rank INTEGER,
monthly_sold INTEGER,
seller_count INTEGER,
amazon_is_seller INTEGER,
raw_product_json TEXT,
last_seen_at TEXT NOT NULL,
raw_inventory_json TEXT,
UNIQUE(run_id, seller_id, asin),
@@ -445,6 +455,9 @@ export function initStalkerDb(database: Database): void {
database.run(
`CREATE INDEX IF NOT EXISTS idx_stalker_inventory_asin ON stalker_seller_inventory(asin);`,
);
database.run(
`CREATE INDEX IF NOT EXISTS idx_stalker_inventory_product_title ON stalker_seller_inventory(product_title);`,
);
}
function resetLegacyStalkerSchema(database: Database): void {
@@ -473,5 +486,9 @@ function inventoryColumnsHaveSellability(database: Database): boolean {
const inventoryColumns = database
.query("PRAGMA table_info(stalker_seller_inventory)")
.all() as Array<{ name: string }>;
return inventoryColumns.some((column) => column.name === "sellability_status");
const columnNames = new Set(inventoryColumns.map((column) => column.name));
return (
columnNames.has("sellability_status") &&
columnNames.has("product_title")
);
}