api.routes.internal.catalog.units

The Unit of one received item, written as soon as operations finish it: its fields, its reprise, and the operations’ photos (Photos interne). See the catalog-intake guide in the public documentation site.

Attributes

Classes

Functions

sync_unit(payload[, sync])

Crée l'unité (avec sa reprise, et le prix de rachat et les photos

upload_photo(unit_id, payload[, at])

Idempotent par nom de fichier (rw-…) : renvoie l'attachement déjà

remove_photos(unit_id, payload[, at])

Retire seulement ces pièces jointes ; les autres restent.

remove_unit(unit_id[, sync])

409 unit_locked si l'unité est vendue, réservée, commandée, aux

restore_unit(unit_id, payload[, sync])

restored: false si l'unité n'existe plus.

Module Contents

api.routes.internal.catalog.units.logger
api.routes.internal.catalog.units.router
api.routes.internal.catalog.units.PHOTO_FILENAME
api.routes.internal.catalog.units.PHOTO_TYPES
api.routes.internal.catalog.units.sync_unit(payload: api.domain.intake.UnitSyncRequest, sync: api.services.catalog_sync.CatalogSync = Depends(get_catalog_sync))

Crée l’unité (avec sa reprise, et le prix de rachat et les photos client de son équipement) ou complète celle qui existe.

  • 200 in_sync : écrit ; written est la nouvelle référence.

  • 200 conflict : modifiée dans Airtable depuis le dernier envoi, non écrasée.

  • 502 : relancer avec le même idempotency_key (jamais de doublon).

class api.routes.internal.catalog.units.PhotoUpload

Bases: pydantic.BaseModel

image_b64: str
content_type: str = 'image/jpeg'
filename: str
api.routes.internal.catalog.units.upload_photo(unit_id: str, payload: PhotoUpload, at: api.services.unit_photos.PhotoGateway = Depends(get_attachment_gateway))

Idempotent par nom de fichier (rw-…) : renvoie l’attachement déjà présent au lieu d’en ajouter un second.

class api.routes.internal.catalog.units.PhotoRemoval

Bases: pydantic.BaseModel

attachment_ids: list[str]
api.routes.internal.catalog.units.remove_photos(unit_id: str, payload: PhotoRemoval, at: api.services.unit_photos.PhotoGateway = Depends(get_attachment_gateway))

Retire seulement ces pièces jointes ; les autres restent.

api.routes.internal.catalog.units.remove_unit(unit_id: str, sync: api.services.catalog_sync.CatalogSync = Depends(get_catalog_sync))

409 unit_locked si l’unité est vendue, réservée, commandée, aux enchères ou liée à une vente / un devis. Déjà supprimée : 200.

class api.routes.internal.catalog.units.UnitRestoreRequest

Bases: pydantic.BaseModel

fields: dict[str, Any]
api.routes.internal.catalog.units.restore_unit(unit_id: str, payload: UnitRestoreRequest, sync: api.services.catalog_sync.CatalogSync = Depends(get_catalog_sync))

restored: false si l’unité n’existe plus.