Skip to content
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

Merged
merged 10 commits into from
Aug 29, 2023
Merged

HATCH-329: Implement ilike/like array support #63

merged 10 commits into from
Aug 29, 2023

Conversation

nicoledgreene
Copy link
Contributor

No description provided.

@nicoledgreene nicoledgreene changed the title Draft: testing HATCH-329: Implement ilike/like array support Aug 28, 2023
let qsParams;

// check for like or ilike array as parsing should look different
const regex = new RegExp(/(\[\$like\]=\[|\[\$ilike\]=\[)/g);
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

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

What does 2 represent?

Copy link
Contributor Author

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);
Copy link
Contributor

@roy-coder roy-coder Aug 29, 2023

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

@roy-coder roy-coder merged commit 1bfdc93 into main Aug 29, 2023
3 checks passed
@roy-coder roy-coder deleted the HATCH-329 branch August 29, 2023 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants