From 5af86edf835860bc7251f3aa27832e527e82b114 Mon Sep 17 00:00:00 2001 From: Kelly Date: Fri, 12 Dec 2025 23:30:57 -0700 Subject: [PATCH] feat: Update last_payload_at and last_store_discovery_at timestamps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - payload-storage.ts: Update dispensaries.last_payload_at when saving payload - promotion.ts: Update dispensaries.last_store_discovery_at on INSERT/UPDATE 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- backend/src/discovery/promotion.ts | 4 +++- backend/src/utils/payload-storage.ts | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/src/discovery/promotion.ts b/backend/src/discovery/promotion.ts index 7999d2f5..b5f895eb 100644 --- a/backend/src/discovery/promotion.ts +++ b/backend/src/discovery/promotion.ts @@ -337,13 +337,14 @@ async function promoteLocation( last_modified_at, last_modified_by_task, last_modified_task_id, + last_store_discovery_at, created_at, updated_at ) VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, - $31, $32, $33, $34, $35, $36, $37, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP + $31, $32, $33, $34, $35, $36, $37, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP ) ON CONFLICT (platform_dispensary_id) WHERE platform_dispensary_id IS NOT NULL DO UPDATE SET @@ -377,6 +378,7 @@ async function promoteLocation( last_modified_at = EXCLUDED.last_modified_at, last_modified_by_task = EXCLUDED.last_modified_by_task, last_modified_task_id = EXCLUDED.last_modified_task_id, + last_store_discovery_at = CURRENT_TIMESTAMP, updated_at = CURRENT_TIMESTAMP RETURNING id, (xmax = 0) AS inserted `, [ diff --git a/backend/src/utils/payload-storage.ts b/backend/src/utils/payload-storage.ts index 7c60872b..9a481c91 100644 --- a/backend/src/utils/payload-storage.ts +++ b/backend/src/utils/payload-storage.ts @@ -198,6 +198,11 @@ export async function saveRawPayload( checksum ]); + // Update dispensary timestamp + await pool.query(` + UPDATE dispensaries SET last_payload_at = $2 WHERE id = $1 + `, [dispensaryId, timestamp]); + const backend = useMinIO ? 'MinIO' : 'local'; console.log(`[PayloadStorage] Saved payload to ${backend} for store ${dispensaryId}: ${storagePath} (${(compressedSize / 1024).toFixed(1)}KB compressed, ${(rawSize / 1024).toFixed(1)}KB raw)`);