-
Notifications
You must be signed in to change notification settings - Fork 5
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
HATCH-329: Implement ilike/like array support #63
Conversation
let qsParams; | ||
|
||
// check for like or ilike array as parsing should look different | ||
const regex = new RegExp(/(\[\$like\]=\[|\[\$ilike\]=\[)/g); |
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 function is already quite long, can we try exporting the new logic into a separate testable function?
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.
done.
// Handle like/ilike for array of strings | ||
else if ( | ||
(key === Operator.LIKE || key === Operator.ILIKE) && | ||
filters[key].length > 2 |
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.
What does 2 represent?
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.
added a comment for this. lmk if you still have questions
const splitQuerystring = querystring.split(iLikeLikeRegExp); | ||
const objectKey = splitQuerystring[0].concat(splitQuerystring[1]); | ||
|
||
const arraySplitRegex = new RegExp(/(=)/g); |
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 hope we can change it in a way that qs.parse
gets the array for us. Something with the %20
spaces looks off to me
No description provided.