feat: transition bestseller analysis storage to SQLite and add category blacklist

- Replaces Excel output with structured database tables for tracking category analysis runs and product results.
- Implements a blacklist to exclude specific category IDs from the bestseller pipeline.
- Adds unit tests for category processing and enhances logging with levels and timestamps.
- Introduces foreign key enforcement and updated schema definitions in the database module.
This commit is contained in:
Victor Noguera
2026-04-13 00:28:23 -04:00
parent 7ba6397578
commit a906f5ede3
7 changed files with 434 additions and 242 deletions

View File

@@ -73,3 +73,45 @@ export interface AnalysisResult {
product: EnrichedProduct;
verdict: LlmVerdict;
}
export interface CategoryRunSummaryDb {
categoryId: number;
categoryLabel: string;
runTimestamp: string;
topAsinsChecked: number;
availableAsins: number;
fbaCount: number;
fbmCount: number;
skipCount: number;
status: "ok" | "empty" | "failed";
errorMessage?: string;
}
export interface ProductAnalysisResultDb {
asin: string;
runId: number;
name: string;
brand?: string;
category?: string;
unitCost?: number;
currentPrice?: number;
avgPrice90d?: number;
avgPrice90dSheet?: number;
sellingPriceSheet?: number;
salesRank?: number;
salesRankAvg90d?: number;
sellerCount?: number;
monthlySold?: number;
rankDrops30d?: number;
rankDrops90d?: number;
fbaFee?: number;
fbmFee?: number;
referralPercent?: number;
canSell?: string;
sellabilityStatus?: string;
sellabilityReason?: string;
verdict: string;
confidence: number;
reasoning?: string;
fetchedAt: string;
}