api.domain.intake ================= .. py:module:: api.domain.intake .. autoapi-nested-parse:: Payloads exchanged with app.rewake.fr for the product intake workflow. The app owns the workflow state (receiving batches, product groups, review); the API only turns one product group into Airtable records. Every entity the app sends carries a ``ref``: a stable, app-side identifier (e.g. ``"variation:12"``) used to remember which Airtable record it became, so a retried push never creates the same record twice (see api/services/catalog_sync.py). See the catalog-intake guide in the public documentation site and the product-creation spec (§6E). Classes ------- .. autoapisummary:: api.domain.intake.SpecIn api.domain.intake.ModelIn api.domain.intake.VariationIn api.domain.intake.UnitValues api.domain.intake.UnitIn api.domain.intake.UnitCreation api.domain.intake.UnitSyncRequest api.domain.intake.UnitRestore api.domain.intake.PushRequest api.domain.intake.Conflict api.domain.intake.PushResult api.domain.intake.UnitSyncResult api.domain.intake.VariantConversion api.domain.intake.ValidateRequest api.domain.intake.UnvalidateRequest api.domain.intake.CompatLink api.domain.intake.CancelRequest api.domain.intake.CancelResult api.domain.intake.AccessoryLinkResult Module Contents --------------- .. py:class:: SpecIn Bases: :py:obj:`pydantic.BaseModel` One Airtable ``Specification`` record: key (a ``Specification type`` record), value and unit. .. py:attribute:: ref :type: str .. py:attribute:: spec_type_id :type: str .. py:attribute:: valeur :type: str .. py:attribute:: unite :type: str | None :value: None .. py:attribute:: airtable_id :type: str | None :value: None .. py:class:: ModelIn Bases: :py:obj:`pydantic.BaseModel` The group's Model. ``created_by_group=False`` means the group selected an existing Model: the push links to it but never edits or deletes it. .. py:attribute:: ref :type: str .. py:attribute:: airtable_id :type: str | None :value: None .. py:attribute:: created_by_group :type: bool :value: True .. py:attribute:: modele :type: str :value: '' .. py:attribute:: marque_id :type: str | None :value: None .. py:attribute:: type_id :type: str | None :value: None .. py:attribute:: longueur_mm :type: float | None :value: None .. py:attribute:: hauteur_mm :type: float | None :value: None .. py:attribute:: profondeur_mm :type: float | None :value: None .. py:attribute:: poids_kg :type: float | None :value: None .. py:attribute:: short_description :type: str | None :value: None .. py:attribute:: long_description :type: str | None :value: None .. py:class:: VariationIn Bases: :py:obj:`pydantic.BaseModel` A Variation of the group's Model. ``created_by_group=False`` means an existing Variation the group's Units are added to: never edited here. .. py:attribute:: ref :type: str .. py:attribute:: airtable_id :type: str | None :value: None .. py:attribute:: created_by_group :type: bool :value: True .. py:attribute:: is_variant :type: bool :value: False .. py:attribute:: axis :type: SpecIn | None :value: None .. py:attribute:: specs :type: list[SpecIn] .. py:class:: UnitValues Bases: :py:obj:`pydantic.BaseModel` What operations recorded about one physical item. .. py:attribute:: numero_de_serie :type: str | None :value: None .. py:attribute:: etat_esthetique :type: str | None :value: None .. py:attribute:: etat_fonctionnel :type: str | None :value: None .. py:attribute:: commentaire_atelier :type: str | None :value: None .. py:attribute:: host_variation_id :type: str | None :value: None .. py:class:: UnitIn Bases: :py:obj:`UnitValues` One physical item (``Toutes les unités``) of a product group. .. py:attribute:: ref :type: str .. py:attribute:: airtable_id :type: str | None :value: None .. py:attribute:: variation_ref :type: str .. py:class:: UnitCreation Bases: :py:obj:`pydantic.BaseModel` Set only when the Unit is created (a pre-created reprise Unit already has them): the reprise it comes from and, for an item of the reprise proposal, that equipment row, whose buy-back price and client photos are copied (read at creation: attachment links expire). .. py:attribute:: operation_id :type: str | None :value: None .. py:attribute:: equipment_id :type: str | None :value: None .. py:class:: UnitSyncRequest Bases: :py:obj:`UnitValues` Create or complete the Unit of one received item, once operations finished it. ``idempotency_key`` is stable per item (``app-unit:``): a retry never creates a second Unit. ``baseline`` maps the Unit's record id to the fields the app last wrote there (conflict detection, as for a group push). .. py:attribute:: idempotency_key :type: str .. py:attribute:: airtable_id :type: str | None :value: None .. py:attribute:: variation_id :type: str .. py:attribute:: creation :type: UnitCreation .. py:attribute:: baseline :type: dict[str, dict[str, Any]] .. py:class:: UnitRestore Bases: :py:obj:`pydantic.BaseModel` A pre-created reprise Unit given back its values from before the first push (rule 9): it is never deleted by this flow. .. py:attribute:: unit_id :type: str .. py:attribute:: fields :type: dict[str, Any] .. py:class:: PushRequest Bases: :py:obj:`pydantic.BaseModel` Create or update one product group in Airtable (draft push, §6E1-E2). ``baseline`` maps an Airtable record id to the field values the app last wrote there; a record whose current values differ from its baseline was edited in Airtable since, and is reported as a conflict instead of being overwritten. .. py:attribute:: idempotency_key :type: str .. py:attribute:: model :type: ModelIn .. py:attribute:: variations :type: list[VariationIn] .. py:attribute:: units :type: list[UnitIn] .. py:attribute:: removed_unit_ids :type: list[str] .. py:attribute:: removed_spec_ids :type: list[str] .. py:attribute:: removed_variation_ids :type: list[str] .. py:attribute:: restored_units :type: list[UnitRestore] .. py:attribute:: baseline :type: dict[str, dict[str, Any]] .. py:class:: Conflict Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: table :type: str .. py:attribute:: airtable_id :type: str .. py:attribute:: field :type: str .. py:attribute:: baseline :type: Any :value: None .. py:attribute:: current :type: Any :value: None .. py:class:: PushResult Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: status :type: Literal['in_sync', 'conflict'] .. py:attribute:: ids :type: dict[str, str] .. py:attribute:: written :type: dict[str, dict[str, Any]] .. py:attribute:: conflicts :type: list[Conflict] .. py:class:: UnitSyncResult Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: status :type: Literal['in_sync', 'conflict'] .. py:attribute:: id :type: str .. py:attribute:: created :type: bool .. py:attribute:: written :type: dict[str, Any] .. py:attribute:: conflicts :type: list[Conflict] .. py:class:: VariantConversion Bases: :py:obj:`pydantic.BaseModel` An existing default Variation turned into a variant on validation (§6B). .. py:attribute:: variation_id :type: str .. py:attribute:: axis :type: SpecIn .. py:class:: ValidateRequest Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: model_id :type: str .. py:attribute:: variation_ids :type: list[str] .. py:attribute:: conversions :type: list[VariantConversion] .. py:attribute:: confirm_shopify :type: bool :value: False .. py:class:: UnvalidateRequest Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: model_id :type: str .. py:attribute:: variation_ids :type: list[str] .. py:class:: CompatLink Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: host_model_id :type: str .. py:attribute:: accessory_model_id :type: str .. py:class:: CancelRequest Bases: :py:obj:`pydantic.BaseModel` Delete what a cancelled group created in Airtable (§6E6). Records the group only selected must not be listed here. .. py:attribute:: model_id :type: str | None :value: None .. py:attribute:: model_created :type: bool :value: False .. py:attribute:: variation_ids :type: list[str] .. py:attribute:: spec_ids :type: list[str] .. py:attribute:: unit_ids :type: list[str] .. py:attribute:: restore_units :type: list[UnitRestore] .. py:attribute:: compat_links :type: list[CompatLink] .. py:class:: CancelResult Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: deleted :type: dict[str, list[str]] .. py:attribute:: restored_unit_ids :type: list[str] .. py:attribute:: compat_links_removed :type: int .. py:class:: AccessoryLinkResult Bases: :py:obj:`pydantic.BaseModel` .. py:attribute:: compat_row_id :type: str .. py:attribute:: row_created :type: bool .. py:attribute:: already_linked :type: bool