Repository navigation
Conversation
Introduces the CommunityFridge schema, migration, and test fixtures as the first step of the community fridges feature.
The cubic-dev review suggested supporting a `location:` key in fixture(:community_fridge, ...) so callers can pass a location struct directly, matching the pattern used by rider and campaign fixtures. Implementing this requires fixture(:location) to persist a Location record and return a struct with an id, rather than returning a plain map as it does today. That change affects every fixture and test that currently calls fixture(:location), so the blast radius is wider than this PR's scope. The improvement will be handled in a follow-up PR dedicated to normalising the location fixture across the test suite.
Add unique_constraint(:location_id) to CommunityFridge.changeset/2 so a location cannot be associated with more than one community fridge. The has_one relationship does not enforce cardinality at the database level, so this constraint surfaces duplicate-location errors as changeset errors. Also trim the minimal-attributes changeset test to focus on required fields rather than default values.
- Add `persisted_location` fixture that inserts a Location into the
database
(complements existing in-memory `location` fixture)
- Add `community_fridge` fixture that lazily creates a persisted location
and
handles required location_id association
- Add LocationsTest with full coverage of community_fridge operations
- Use setup block to eliminate fixture repetition across tests
- Use pin operator (^) in pattern matches to validate update attrs without
assertion repetition
- Enable async: true for parallel test execution
Changes: - Add CommunityFridgeLive.Index and FormComponent with routes for /community_fridges, /community_fridges/new, and /community_fridges/:id/edit - Add "Community Fridges" entry to the sidebar navigation (archive_box icon) - Relax CommunityFridge changeset to not require location_id at the UI level (name is the only required field; location association remains constrained at the DB level via assoc_constraint) - Add LiveView tests covering list, create, validate, edit, direct navigation, and access control (non-dispatchers redirected to /login)
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (8)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe changes add dispatcher routes and a LiveView interface to list, create, and edit community fridges. The form validates required names, and the changeset no longer requires a location ID. ChangesCommunity fridge management
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue is established for the community-fridge pages. They are mergeable after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 6 files. (2 skipped: 2 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Introduces the CommunityFridge schema, migration, and test fixtures as the first step of the community fridges feature.
The cubic-dev review suggested supporting a `location:` key in fixture(:community_fridge, ...) so callers can pass a location struct directly, matching the pattern used by rider and campaign fixtures. Implementing this requires fixture(:location) to persist a Location record and return a struct with an id, rather than returning a plain map as it does today. That change affects every fixture and test that currently calls fixture(:location), so the blast radius is wider than this PR's scope. The improvement will be handled in a follow-up PR dedicated to normalising the location fixture across the test suite.
Add unique_constraint(:location_id) to CommunityFridge.changeset/2 so a location cannot be associated with more than one community fridge. The has_one relationship does not enforce cardinality at the database level, so this constraint surfaces duplicate-location errors as changeset errors. Also trim the minimal-attributes changeset test to focus on required fields rather than default values.
- Add `persisted_location` fixture that inserts a Location into the
database
(complements existing in-memory `location` fixture)
- Add `community_fridge` fixture that lazily creates a persisted location
and
handles required location_id association
- Add LocationsTest with full coverage of community_fridge operations
- Use setup block to eliminate fixture repetition across tests
- Use pin operator (^) in pattern matches to validate update attrs without
assertion repetition
- Enable async: true for parallel test execution
144a202 to
8849b2b
Compare
…o vn/community-fridge-ui-v1
… attr - Remove duplicate list_community_fridges/0 call from apply_action(:index) since mount/3 already loads the list on every mount - Add :community_fridges to the current_page attr values list in layouts.ex
|
Superseded by #540. Work consolidated into vn/community-fridge-feature for unified review. |
Describe your changes
Adds the Community Fridges dispatcher UI, building on the data model and CRUD context added in #508.
Changes:
CommunityFridgeLive.IndexandCommunityFridgeLive.FormComponentwith routes for/community_fridges,/community_fridges/new, and/community_fridges/:id/editCommunityFridgechangeset to not requirelocation_idat the UI level — name is the only required field;:community_fridgesas a valid page in the layout'scurrent_pageattribute/login)Checklist before requesting a review
Summary by CodeRabbit