Skip to content
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

Improve update method when item is not found #176

Conversation

julianaklulo
Copy link
Contributor

@julianaklulo julianaklulo commented Oct 21, 2024

Pull Request Template for FastCRUD

Description

Improve the behaviour of CRUD update method when the filtered item for update is not found.

It was requested (and closes #137) to keep consistency with the CRUD delete method.

Changes

Raise exception NoResultFound when the filters for the object to update don't match any items.

Tests

Updated:
sqlalchemy/crud/test_update.py: test_update_non_existent_record, test_update_invalid_filters
sqlalchemy/crud/test_get_multi_by_cursor.py: test_test_get_multi_by_cursor_pagination_integrity

sqlmodel/crud/test_update.py: test_update_non_existent_record, test_update_invalid_filters
sqlmodel/crud/test_get_multi_by_cursor.py: test_test_get_multi_by_cursor_pagination_integrity

Checklist

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • I have added necessary documentation (if appropriate).
  • I have added tests that cover my changes (if applicable).
  • All new and existing tests passed.

Additional Notes

Include any additional information that you think is important for reviewers to know.

@julianaklulo julianaklulo force-pushed the enhancement/improve-update-when-not-found branch from 1df782a to 2bd5062 Compare October 21, 2024 17:48
Copy link
Owner

@igorbenav igorbenav left a comment

Choose a reason for hiding this comment

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

Hey, @julianaklulo, great first PR🚀!
Thank you so much. Just one thing, can you please make it like this so we raise a warning for now (explaining that stuff will change) and then easily change this behavior in the next version?

@julianaklulo julianaklulo force-pushed the enhancement/improve-update-when-not-found branch from 6784a56 to 0cb5cb8 Compare October 21, 2024 18:46
Copy link
Owner

@igorbenav igorbenav left a comment

Choose a reason for hiding this comment

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

Great contribution, @julianaklulo, welcome to FastCRUD contributors🎉

@igorbenav igorbenav merged commit d4e8909 into igorbenav:main Oct 21, 2024
7 checks passed
@julianaklulo julianaklulo deleted the enhancement/improve-update-when-not-found branch October 21, 2024 19:33
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.

Can the response format be standardized?
2 participants