MEGAINFRA-WEBAPP/scripts
DEls 4f9af4a2a6 fix(purchasing): restore the 30-day PO dedup window with a real timestamp
Task 13 moved PO creation to upload time and needed a hash-dedup window
matching the spec's "same 30-day dedup window as today" (design doc
section 4.1). purchase_orders has no working created/updated autodate
field on this PocketBase instance, and unlike delivery_notes it had no
other timestamp field either -- the first cut of Task 13 correctly found
this, but responded by dropping the time window entirely rather than
adding one. That's a real behaviour change from spec, not just a
workaround: a PO file legitimately re-sent long after the original would
have been flagged a duplicate forever, with no way to age out.

Added purchase_orders.date_uploaded (additive, mirrors how
delivery_notes already uses its own date_received) and wired it through:
stamped at create, filtered on in the dedup query.

Also brought PurchaseOrderRecord in pb-types.ts in line with what Task 1
already put on the live schema and what the upload route now writes --
processing_status/attempts/last_error/next_retry_at/last_attempt_at/
file_hash/date_uploaded were live in production but absent from the
TypeScript interface. docs/data-model.md section 7 documents this exact
gap as a standing foot-gun; closing it now while it's fresh.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-11 14:17:42 +02:00
..
__pycache__ feat(dashboard): enhance operations dashboard with rain outlook and coordinate support 2026-09-06 19:59:52 +02:00
migrations fix(purchasing): restore the 30-day PO dedup window with a real timestamp 2026-09-11 14:17:42 +02:00
build-icons.mjs refactor(pwa): address code review on build-icons.mjs 2026-08-30 22:18:25 +02:00
build-og-image.mjs Add Open Graph image + social link preview metadata 2026-08-09 20:01:13 +02:00
generate-plant-hours-template.ts fix(plant-hours-template): ESM-safe __dirname + freeze note 2026-08-28 12:55:08 +02:00
migrate-delivery-notes-ocr.py feat(delivery-notes): enhance delivery note upload and processing 2026-08-26 15:33:30 +02:00
migrate-plant-hours-backfill-vehicle.py refactor(plant): enhance PlantPage and PlantView for fuel log integration 2026-09-02 12:36:10 +02:00
patch-next-dev-blocker.cjs Fix Coolify build: skip postinstall in deps stage 2026-08-09 02:29:48 +02:00
pb-add-fuel-prices.py feat(dashboard): enhance operations dashboard with rain outlook and coordinate support 2026-09-06 19:59:52 +02:00
pb-add-site-coordinates.py feat(dashboard): enhance operations dashboard with rain outlook and coordinate support 2026-09-06 19:59:52 +02:00
pb-add-site-job-start-date.py feat(dashboard): enhance operations dashboard with rain outlook and coordinate support 2026-09-06 19:59:52 +02:00
pb-backup-collection.py feat(dashboard): enhance operations dashboard with rain outlook and coordinate support 2026-09-06 19:59:52 +02:00
pb-bootstrap-schema.py fix(pb): make vehicles.unit_type optional 2026-08-28 15:26:33 +02:00
pb-delete-fixed-costs.py feat(dashboard): enhance operations dashboard with rain outlook and coordinate support 2026-09-06 19:59:52 +02:00
pb-relax-rules.py Update package dependencies and remove unused API routes 2026-08-19 00:14:47 +02:00
pb-show-fixed-costs.py feat(dashboard): enhance operations dashboard with rain outlook and coordinate support 2026-09-06 19:59:52 +02:00
pb-show-sites.py feat(dashboard): enhance operations dashboard with rain outlook and coordinate support 2026-09-06 19:59:52 +02:00
pb_env.py feat(dashboard): enhance operations dashboard with rain outlook and coordinate support 2026-09-06 19:59:52 +02:00