api.services.review_queue

The commercial team’s review queue: Models to verify for the site.

A Model is to review while its Vérification pour site is unchecked and it has stock (Units A vendre or Non traité) or a Variation created by operations and still À valider. Units on sale come first (those meant for the site before the others): they are sold on the strength of a sheet nobody checked. Verifying sets the Model’s checkbox and its Variations’ Statut verification (Vérifié); a Variation still À valider becomes Validé.

Reading the queue takes ~15 s of Airtable calls (the stock is paged): it is cached and rebuilt in the background, and a verified Model leaves it at once.

Attributes

Functions

build_queue(options[, fetch]) → list[dict[str, Any]]

Models to review, most urgent first. options is

get_queue(options_loader[, refresh]) → tuple[list[dict[str, Any]], float]

The queue and its age in seconds. Built on the first call (or on

forget(model_id) → None

A Model verified (or not any more): the cached queue drops it now; an

clear_cache() → None

expire_cache() → None

Rebuild in the background at the next read (keeps serving meanwhile).

verify(at, model_id) → dict[str, Any]

Mark the Model verified for the site. Refused (409

unverify(at, model_id) → dict[str, Any]

Back to review: the Model unchecked, its Variations Non vérifié

Module Contents

api.services.review_queue.MODEL_TABLE = 'Model'
api.services.review_queue.VARIATION_TABLE = 'Variation'
api.services.review_queue.VERIFIED_FIELD = 'Vérification pour site'
api.services.review_queue.TO_SELL_FIELD = 'to_sell_on_shopify'
api.services.review_queue.VARIATION_VERIFICATION_FIELD = 'Statut verification'
api.services.review_queue.UNIT_MODEL_LOOKUP = 'Model (à partir de Référence variant)'
api.services.review_queue.QUEUE_TTL_SECONDS = 300
api.services.review_queue.MODEL_CHUNK = 50
api.services.review_queue.MODEL_WORKERS = 4
api.services.review_queue.MODEL_FIELDS
api.services.review_queue.Fetch
api.services.review_queue.logger
api.services.review_queue.build_queue(options: dict[str, Any], fetch: Fetch | None = None) → list[dict[str, Any]]

Models to review, most urgent first. options is catalog_lookup.load_options() (brand and type names).

api.services.review_queue.get_queue(options_loader: collections.abc.Callable[[], dict[str, Any]], refresh: bool = False) → tuple[list[dict[str, Any]], float]

The queue and its age in seconds. Built on the first call (or on refresh); afterwards served from cache and rebuilt in the background once older than QUEUE_TTL_SECONDS (reading it takes ~15 s).

api.services.review_queue.forget(model_id: str) → None

A Model verified (or not any more): the cached queue drops it now; an un-verified one comes back with the next rebuild.

api.services.review_queue.clear_cache() → None
api.services.review_queue.expire_cache() → None

Rebuild in the background at the next read (keeps serving meanwhile).

api.services.review_queue.verify(at: api.services.catalog_sync.AirtableGateway, model_id: str) → dict[str, Any]

Mark the Model verified for the site. Refused (409 shopify_decision_required) until to_sell_on_shopify is set.

api.services.review_queue.unverify(at: api.services.catalog_sync.AirtableGateway, model_id: str) → dict[str, Any]

Back to review: the Model unchecked, its Variations Non vérifié (a Variation validated stays Validé).