Rev 37328 |
Last modification |
Compare with Previous |
View Log
| RSS feed
Last modification
- Rev 37329 2026-08-17 21:07:00
- Author: amit
- Log message:
- Add offers-schema repositories for the Pine Labs affordability circular
Three repositories over the offers schema, split by who is allowed to write what:
- OfferCircularRepository - read side for the review screen (verbatim rows,
documents, per-offer parsed detail)
- CircularIngestRepository - write side for ingest; claims a DRAFT document with
a guarded UPDATE and deletes only rows derived from that one document, so
re-ingesting one month cannot disturb another
- OfferCurationRepository - write side for manual curation
The split is deliberate: a caller that only displays circulars should not hold a
handle that can rewrite the scope config or the offer tables.
OfferCurationRepository writes offers.product_alias and nothing else. An alias is
config, keyed on (division_id, raw_text), so re-ingest reproduces it and one
decision carries into every later circular. Writing offer_product instead would be
derived data that re-ingest deletes, which is why doing so has to set
manually_curated and freeze the circular permanently - not a trade worth making for
a naming decision, so this repository cannot make it.
A PIN is validated against the division's own brand and category before it is
stored. Nothing downstream re-checks a pinned id - the matcher takes it at face
value - so an unverified exception would silently mismap money.