Skip to content

Add collection_name to ItemRead response#23

Merged
amrtgaber merged 1 commit intomainfrom
feat/item-collection-name
Feb 6, 2026
Merged

Add collection_name to ItemRead response#23
amrtgaber merged 1 commit intomainfrom
feat/item-collection-name

Conversation

@amrtgaber
Copy link
Contributor

Summary

  • Eager-load the collection relationship on Item model (lazy="selectin") to match the pattern used by tags, marks, images, etc.
  • Add collection_name computed property to Item model that returns the collection's name (or None)
  • Add collection_name: str | None field to ItemRead schema so API consumers can display collection names without extra lookups
  • Add tests verifying collection_name in list, get, and null-collection responses

Test plan

  • uv run pytest — all 118 tests pass
  • New tests: test_collection_name_in_list, test_collection_name_in_get, test_collection_name_null_without_collection

Eager-load the collection relationship on Item (lazy="selectin") and
expose a collection_name computed property so API consumers can display
the collection name without a separate lookup.
@amrtgaber amrtgaber merged commit 6f872b3 into main Feb 6, 2026
2 checks passed
@amrtgaber amrtgaber deleted the feat/item-collection-name branch February 6, 2026 23:58
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