Adjust Size model and create SizeRangeSize for sizes_sizegroup join table#2679
Merged
Conversation
…table Agent-Logs-Url: https://github.com/boxwise/boxtribute/sessions/659482ae-deae-4e84-8783-7e62026bf086 Co-authored-by: pylipp <10617122+pylipp@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pylipp
April 21, 2026 16:14
View session
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2679 +/- ##
=======================================
Coverage 76.76% 76.77%
=======================================
Files 301 302 +1
Lines 22266 22274 +8
Branches 2250 2249 -1
=======================================
+ Hits 17093 17101 +8
Misses 5125 5125
Partials 48 48
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the backend data model and query layer to align with the DB migration that replaces the sizes.sizegroup_id FK with a sizes_sizegroup join table, enabling many-to-many associations between sizes and size ranges.
Changes:
- Removes obsolete columns from the
Sizemodel and introduces theSizeRangeSizejoin model. - Refactors loaders and business logic queries to traverse
SizeRange ↔ SizeviaSizeRangeSize. - Updates test data setup and the minimal SQL seed to reflect the new schema.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| back/test/data/size.py | Updates size fixture data to remove the old size_range FK field. |
| back/test/data/size_range_size.py | Adds fixture data for the new sizes_sizegroup join table. |
| back/test/data/init.py | Ensures join-table fixture creation runs in the correct dependency order. |
| back/test/auth0_integration_tests/test_operations.py | Adjusts expected sizeRanges count after sizegroup changes. |
| back/minimal.sql | Updates schema + seed data: drops old sizes columns and adds sizes_sizegroup table + data. |
| back/boxtribute_server/models/definitions/size.py | Removes legacy fields from the Size Peewee model. |
| back/boxtribute_server/models/definitions/size_range_size.py | Introduces the new Peewee model for sizes_sizegroup. |
| back/boxtribute_server/models/init.py | Registers SizeRangeSize in the global model list. |
| back/boxtribute_server/graph_ql/loaders.py | Refactors SizesForSizeRangeLoader to read sizes via the join table. |
| back/boxtribute_server/cron/data_faking.py | Updates size lookup query to traverse via SizeRangeSize/SizeRange. |
| back/boxtribute_server/business_logic/warehouse/box/crud.py | Refactors bulk-create sizing lookup to use SizeRangeSize mappings. |
| back/boxtribute_server/business_logic/mobile_distribution/crud.py | Updates packing-list size selection query to use the join table path. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The DB migration in boxwise/dropapp#821 removes
sizes.sizegroup_idandsizes.seq, replacing the direct FK with a newsizes_sizegroupcross-reference table. This PR updates the BE models and all query code to match.Model changes
Size: removedseqandsize_range(sizegroup_id FK) fieldsSizeRangeSize(new): mapssizes_sizegroupwithsize_id → sizesandsizegroup_id → sizegroup, usingCompositeKey("size", "size_range")models/__init__.py: registersSizeRangeSizeinMODELSQuery updates
All code that previously joined
SizetoSizeRangedirectly now routes throughSizeRangeSize:Affected files:
loaders.py(SizesForSizeRangeLoader),warehouse/box/crud.py(bulk create),mobile_distribution/crud.py,cron/data_faking.py.Test data
size_rangefrom size fixturessize_range_size.pytest data module; inserted into_NAMESordering aftersize