refactor: create mixin to share helper functions across repos#597
refactor: create mixin to share helper functions across repos#597gwynndp wants to merge 5 commits intoGreenstand:masterfrom
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. |
nmcharlton
left a comment
There was a problem hiding this comment.
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.
@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.
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?