Skip to content

Add sorting for nested list structures #194

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bantoinese83
Copy link

@bantoinese83 bantoinese83 commented Jan 13, 2025

Add sorting functionality for nested items in one-to-many and many-to-many relationships.

  • Add sort_columns and sort_orders attributes to JoinConfig class in fastcrud/crud/helper.py.
  • Validate sort_columns and sort_orders in JoinConfig class.
  • Update _prepare_and_apply_joins method in fastcrud/crud/fast_crud.py to handle sorting of nested items.
  • Add test cases for sorting nested items in one-to-many and many-to-many relationships in tests/sqlalchemy/crud/test_get_multi_joined.py.
  • Add test cases for sorting nested items in one-to-many and many-to-many relationships in tests/sqlmodel/crud/test_get_multi_joined.py.

For more details, open the Copilot Workspace session.

Add sorting functionality for nested items in one-to-many and many-to-many relationships.

* Add `sort_columns` and `sort_orders` attributes to `JoinConfig` class in `fastcrud/crud/helper.py`.
* Validate `sort_columns` and `sort_orders` in `JoinConfig` class.
* Update `_prepare_and_apply_joins` method in `fastcrud/crud/fast_crud.py` to handle sorting of nested items.
* Add test cases for sorting nested items in one-to-many and many-to-many relationships in `tests/sqlalchemy/crud/test_get_multi_joined.py`.
* Add test cases for sorting nested items in one-to-many and many-to-many relationships in `tests/sqlmodel/crud/test_get_multi_joined.py`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/igorbenav/fastcrud?shareId=XXXX-XXXX-XXXX-XXXX).
@igorbenav
Copy link
Collaborator

@bantoinese83 can you please fix the checks?

corrected test function for test_get_multi_joined_sorting_nested_items_many_to_many
ensured that the test correctly verifies the nested participants and the number of project records
Copy link
Author

@bantoinese83 bantoinese83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected test function for test_get_multi_joined_sorting_nested_items_many_to_many

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.

2 participants