-
-
Notifications
You must be signed in to change notification settings - Fork 3
Support for negation and conjunctions on join table in M:M relation #18
Conversation
lib/convertor.js
Outdated
@@ -47,10 +48,9 @@ class MongoToKnex { | |||
* Determine if statement lives on parent table or if statement refers to a relation. | |||
*/ | |||
processStatement(column, op, value) { | |||
const columnParts = column.split('.'); | |||
|
|||
const [tableName, columnName] = column.split('.'); |
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.
Improved the naming a bit as it was hard to see right away what columnParts[0] and columnParts[1] actually mean
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.
This is an obvious improvement to me - I would just push this commit (and any like it) right onto master.
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.
Same goes for all the stuff that's just rejigging tests on its own without any related code changes.
return query | ||
.select() | ||
.then((result) => { | ||
// TODO: should this include tags with no tags? the filter is about primary tag != 'classic' so they should count? |
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.
needs clarification 🤷♂️ but seems correct
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.
Tag with no tags?
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.
tags with no tags!!! and posts without posts!!!
@ErisDS if you have time today would love to receive some feedback on this PR. Didn't reorganise the commits, left comments instead :) |
3350126
to
1cf9b6b
Compare
b117031
to
66c4d41
Compare
fe4558b
to
b6ee673
Compare
b6ee673
to
4497763
Compare
lib/convertor.js
Outdated
@@ -96,7 +96,7 @@ class MongoToKnex { | |||
}; | |||
} | |||
|
|||
// CASE: fallback, `status=draft` -> `posts.status`=draft | |||
// CASE: fallback, `status=drat` -> `posts.status`=draft |
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.
typo?
This all looks good to me - I can see what the changes are intended to accomplish and it all makes sense. 🚢 and continue! |
refs #5
refs #7
This was an attempt to expand existing conjunctions but ended up as a cleanup and extension of existing test cases. The main operation that was missing and has been added is negation and conjunctions support that used joining table in it's filter, e.g:
The rest of M:M cases now seems to be covered.