api.services.unit_photos ======================== .. py:module:: api.services.unit_photos .. autoapi-nested-parse:: Operations' photos of a received item, in its Unit's ``Photos interne``. The app keeps the photos (private, on its server) and uploads each one once, under a name it chooses (``rw--.``): that name finds the attachment again after a lost response, so a retry never adds it twice. Attachments added in Airtable by people are never touched. Attributes ---------- .. autoapisummary:: api.services.unit_photos.MAX_UPLOAD_BYTES api.services.unit_photos.PhotoGateway Functions --------- .. autoapisummary:: api.services.unit_photos.upload_photo api.services.unit_photos.remove_photos Module Contents --------------- .. py:data:: MAX_UPLOAD_BYTES :value: 5242880 .. py:data:: PhotoGateway .. py:function:: upload_photo(at: PhotoGateway, unit_id: str, data: bytes, filename: str, content_type: str) -> str Add the photo to the Unit (unless already there); its attachment id. .. py:function:: remove_photos(at: api.services.catalog_sync.AirtableGateway, unit_id: str, attachment_ids: list[str]) -> list[str] Remove these attachments (the app's own) and keep every other one. Returns the ids actually removed (already gone ones are skipped).