feat: Update last_payload_at and last_store_discovery_at timestamps

- 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)
This commit is contained in:
Kelly
2025-12-12 23:30:57 -07:00
parent 55b26e9153
commit 5af86edf83
2 changed files with 8 additions and 1 deletions

View File

@@ -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
`, [

View File

@@ -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)`);