api.services.unit_photos

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-<photo id>-<kind>.<ext>): 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

Functions

upload_photo(at, unit_id, data, filename, content_type) → str

Add the photo to the Unit (unless already there); its attachment id.

remove_photos(at, unit_id, attachment_ids) → list[str]

Remove these attachments (the app's own) and keep every other one.

Module Contents

api.services.unit_photos.MAX_UPLOAD_BYTES = 5242880
api.services.unit_photos.PhotoGateway
api.services.unit_photos.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.

api.services.unit_photos.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).