Skip to content

feat: add image uploads for items and marks#19

Merged
amrtgaber merged 2 commits intomainfrom
feat/image-uploads
Feb 5, 2026
Merged

feat: add image uploads for items and marks#19
amrtgaber merged 2 commits intomainfrom
feat/image-uploads

Conversation

@amrtgaber
Copy link
Contributor

Summary

  • Add image upload support for items (max 10) and marks (max 3) using Cloudflare R2
  • New Image model with foreign keys to both items and marks (CHECK constraint ensures exactly one parent)
  • Async R2 storage service with upload, delete, and bulk delete operations
  • REST endpoints for uploading, listing, and deleting images on both items and marks
  • Client-side validation: JPEG/PNG/WebP only, 10MB max per file
  • Best-effort R2 cleanup when parent items or marks are deleted
  • 20 new tests covering uploads, deletes, validation, count limits, and user isolation

Test plan

  • uv run pytest — 111 tests passing (20 new)
  • Manual: upload image to item, verify it appears in GET response
  • Manual: upload image to mark, verify it appears in GET response
  • Manual: delete image, verify removed from both DB and R2
  • Manual: delete item with images, verify R2 files cleaned up

- Add Image model with item_id/mark_id foreign keys and CHECK constraint
- Add async R2 storage service (upload, delete, bulk delete) via aioboto3
- Add item image endpoints: POST/GET/DELETE /items/{item_id}/images (max 10)
- Add mark image endpoints: POST/GET/DELETE /items/{item_id}/marks/{mark_id}/images (max 3)
- Add file validation (JPEG/PNG/WebP, 10MB max)
- Add R2 config settings with production validation
- Add best-effort R2 cleanup on item/mark deletion
- Add images relationship to Item and Mark models
- Add ImageRead to ItemRead and MarkRead schemas
- Add 20 tests covering uploads, deletes, validation, limits, and user isolation
@amrtgaber amrtgaber merged commit 1c1b038 into main Feb 5, 2026
2 checks passed
@amrtgaber amrtgaber deleted the feat/image-uploads branch February 6, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant