-
Notifications
You must be signed in to change notification settings - Fork 0
feat(catalogue): add public collections endpoint api #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
vivjd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks like a good start! In addition to the other comment, two other things I think would be great to have:
- add copilot as a reviewer to see if there are any suggestions/fixes that are worth considering
- The PR description mentions tests can be run with
python manage.py test inventory.tests, but I don't seem to see those tests included in this PR. It would be great to add them so we have proper test coverage!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a public-facing, read-only REST API for browsing the collection catalogue without authentication. It addresses issue #8 by creating endpoints that allow public users to search, filter, and view collection items that are marked as publicly visible.
Key Changes:
- Added public API endpoints at
/api/public/items/with comprehensive filtering (platform, is_on_floor) and text search capabilities - Implemented nested location serialization to include location details in collection item responses
- Added extensive test coverage with 19 test cases covering various scenarios including filtering, search, pagination, and access control
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/inventory/views.py | Implements PublicCollectionItemViewSet with read-only access, custom filtering by platform and is_on_floor, and search functionality across title, description, and item_code |
| backend/inventory/serializers.py | Adds PublicCollectionItemSerializer and LocationSerializer to expose appropriate fields for public consumption with nested location data |
| backend/inventory/urls.py | Configures DRF router for public collection item endpoints |
| backend/core/urls.py | Integrates inventory URLs into the main API routing |
| backend/inventory/tests.py | Comprehensive test suite covering list/detail endpoints, filtering, search, authentication requirements, pagination, and edge cases |
| .github/workflows/backend-ci.yml | Adds SECRET_KEY environment variable required for Django operations in CI |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Implements public-facing read-only API endpoints for the collection catalogue. Allows public users to browse and search collection items without authentication.
Related Issues
Changes
PublicCollectionItemSerializerwith nested location dataPublicCollectionItemViewSetwith filtering and search capabilities/api/public/items/endpointsis_public_visible=FalseHow to Test
cd backend
source venv/bin/activate
pytest inventory/tests.py
Checklist