integration tests fixes
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m13s

This commit is contained in:
2025-12-06 19:25:40 -08:00
parent 16e8f6efb9
commit da18719aa5
5 changed files with 90 additions and 10 deletions

View File

@@ -171,7 +171,15 @@ export const flyerWorker = new Worker<FlyerJobData>(
uploaded_by: userId,
};
const newFlyer = await db.createFlyerAndItems(flyerData, extractedData.items);
// Map the AI-extracted DTOs to the shape expected by the database, adding default values.
const itemsForDb = extractedData.items.map(item => ({
...item,
view_count: 0,
click_count: 0,
updated_at: new Date().toISOString(),
}));
const newFlyer = await db.createFlyerAndItems(flyerData, itemsForDb);
logger.info(`[Worker] Successfully saved new flyer ID: ${newFlyer.flyer_id}`);
// 4. Log activity