Add reusable instruction photo uploads (TC-26 to TC-34)
Summary
- Added an independent Instruction Photos library
- Allowed administrators to upload and preview reusable production-step images
- Added photo-name suggestions to production-step configuration
- Allowed existing stored photos to be linked by name
- Allowed new photos to be uploaded and linked while creating a production step
- Displayed actual instruction images on job-detail and Worker Kiosk pages
- Added randomized secure storage filenames
- Preserved original filenames and administrator-facing photo names
- Added case-insensitive photo-name matching
- Restricted uploads to JPEG, PNG and WebP
- Added actual image-content and extension validation using Pillow
- Added a 5 MB upload limit
- Excluded runtime-uploaded images from Git
- Added Instruction Photos navigation across the application
- Preserved legacy photo references already stored in existing production steps
Test Cases
TC-26 — Upload photo to the independent library
An administrator can provide a photo name and upload a valid image. The system stores it with a randomized filename while preserving its original filename and displays it in the Instruction Photos library.
TC-27 — Reject invalid image content
A file with an allowed extension but invalid image contents is rejected. No photo record or stored file is created.
TC-28 — Reject unsupported image type
Files outside the allowed JPEG, PNG and WebP formats are rejected.
TC-29 — Upload and link a photo during step creation
An administrator can enter a new photo name, upload an image while creating a production step, and automatically link the stored image to that step.
TC-30 — Link an existing photo by name
An existing library photo can be selected by name without uploading another copy. Matching ignores capitalization and surrounding spaces.
TC-31 — Reject unknown photo name without a file
Entering a photo name that does not exist without uploading a corresponding file is rejected. No step, part or photo is created.
TC-32 — Require a name for uploaded photos
Selecting an image file without entering a photo name is rejected.
TC-33 — Display uploaded image at the Worker Kiosk
After a job is activated and scanned at its assigned station, the Worker Kiosk displays the actual uploaded instruction image with the production instruction.
TC-34 — Enforce upload size limit
Uploads larger than 5 MB are rejected before creating a photo record.
Verification
Automated test suite:
python -m pytest -v
Result:
56 passed
Dependency verification:
python -m pip check
Result:
No broken requirements found.
Manual verification confirmed:
- Independent image upload and preview
- Existing photo selection through searchable suggestions
- Direct photo upload during production-step creation
- Reusable photos remained stored in the photo library
- Actual images displayed on job-detail pages
- Actual images displayed at the Worker Kiosk
- Uploaded runtime files did not appear in Git status