-
Notifications
You must be signed in to change notification settings - Fork 80
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
refactor: create mixin to share helper functions across repos #597
base: master
Are you sure you want to change the base?
Conversation
@nmcharlton Do you want me to write tests for the mixin or not to bother because we're moving to microservices? I'm also not sure about the queries for "Not set" organizations. The queries filtered for null orgs and for any planters with null orgs. I tried working on this because the captures page was always getting the same result as "All" for "Not set", but the numbers aren't adding up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm inclined to say don't worry about tests, but this logic has caused us a few problems.
If basic tests can be added reasonably easily, it might prevent some headaches should we need to extend the functionality.
8c20ed1
to
3a56200
Compare
3a56200
to
ec76ec9
Compare
ec76ec9
to
8ec649e
Compare
.replace(/"/g, ''); | ||
|
||
whereObjClause.sql = newQueryFields; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nmcharlton
I added this regex to add the modelName back onto each field because our more complex cross-table queries were resulting in "ambiguous" field errors that I couldn't find any other way of resolving. Is there a better way to resolve those errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether the LoopBack query builders have a way of including the table name in the query.
This looks ok, but won't catch every WHERE
clause construction.
1c68d0a
to
4f18f74
Compare
4f18f74
to
b016d72
Compare
Description
Organization of helper functions to reduce duplication across repositories
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
Issue
What is the current behavior?
There are duplicate functions to help build queries for filtering by organization information in the Trees, Planter, and Organization repositories
What is the new behavior?
Can now use a mixin with a repository to import the helper functions from utils.repository-mixin.ts
Steps taken:
Breaking change
Does this PR introduce a breaking change?