Add Receipt model, photo upload, and update CouponUsage schema #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lineage
plan-mcd-tracker→ Phase 5 → Phase 5a: Receipt Model + Photo UploadRepo
forgejo_admin/mcd-tracker-api(primary)forgejo_admin/pal-e-deployments(PVC for photo storage)User Story
scan-receipt: I want to snap a photo of my receipt and have the app store itsave-bogo: I want my BOGO code linked to the receipt it came fromArchitecture
arch-domain-mcd-tracker— adds Receipt entity, updates CouponUsage (receipt_id FK, code→bogo_code, used_at→earned_at)arch-dataflow-mcd-tracker#flow-1-scan-receipt— POST /receipts endpointContext
Phase 5 shipped 8 API endpoints with the original schema (Location + CouponUsage). The UX pivot to receipt-first workflow requires a Receipt entity to track photos, survey codes, and survey completion. CouponUsage needs updating to link back to receipts and use clearer field names (bogo_code not code, earned_at not used_at).
The app already has photo upload infrastructure proven in basketball-api (PVC mount pattern).
File Targets
Files to create:
src/mcd_tracker_api/models/receipt.py(or add to existing models.py) — Receipt SQLAlchemy modelsrc/mcd_tracker_api/routes/receipts.py— POST /receipts (multipart), GET /receipts, GET /receipts/{id}/photoalembic/versions/002_add_receipt_and_update_coupon_usage.py— migration: create receipt table, add receipt_id to coupon_usage, rename code→bogo_code, rename used_at→earned_attests/test_receipts.py— receipt upload, photo serving, receipt-code linkingFiles to modify:
src/mcd_tracker_api/models.py— add Receipt model, update CouponUsage (receipt_id, bogo_code, earned_at)src/mcd_tracker_api/schemas.py— add ReceiptCreate/ReceiptResponse, update CodeCreate/CodeResponse for bogo_code + receipt_idsrc/mcd_tracker_api/routes/locations.py— update POST /codes to accept optional receipt_id, update field namessrc/mcd_tracker_api/routes/dashboard.py— update field referencessrc/mcd_tracker_api/routes/admin.py— update field referencessrc/mcd_tracker_api/main.py— register receipts routerpyproject.toml— add python-multipart dependencytests/test_locations.py— update field names in existing tests (code→bogo_code, used_at→earned_at)Files NOT to touch:
src/mcd_tracker_api/auth.py— no changes.woodpecker.yaml— no changesAcceptance Criteria
Test Expectations
pytest tests/ -vConstraints
python-multipartfor file upload handling (FastAPI requirement for multipart)/data/uploads/receipts/{uuid}.jpg(uuid generated server-side)op.alter_columnwithnew_column_nameparameterChecklist
Closes #7Related
phase-mcd-tracker-5a-receipt-model— phase notearch-domain-mcd-tracker— updated entity modelplan-mcd-tracker— parent plan