Skip to content

feat(query): add translateAliases option to automatically call translate aliases on query fields #13397

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 5 commits into from
May 15, 2023

Conversation

vkarpov15
Copy link
Collaborator

Fix #7511
Fix #8678

Summary

Add translateAliases option on query, schema, and global level to apply Model.translateAliases() on all query fields automatically: filter, projection, update, and distinct.

Examples

Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

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

looks good to me, though there are some thing that should still be done:

  • test if the alias takes priority or errors if both are defined at the same time in the query
  • test if the alias has any effect if the alias is used in a query but the actual property in a update (or vise-versa)
  • document the above behavior somewhere on the documentation

also i dont know how feasible it is, but maybe consider calling _applyTranslateAliases in _optionsForExec?

Co-authored-by: hasezoey <hasezoey@gmail.com>
Copy link
Collaborator

@AbdelrahmanHafez AbdelrahmanHafez left a comment

Choose a reason for hiding this comment

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

Got a couple of questions, but overall LGTM. Thanks! 👍

@vkarpov15 vkarpov15 merged commit ca84162 into 7.2 May 15, 2023
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-7511 branch May 16, 2023 01:08
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants