Parse-SDK-JS icon indicating copy to clipboard operation
Parse-SDK-JS copied to clipboard

feat: combine equalTo clauses with clauses

Open sadakchap opened this issue 4 years ago • 5 comments

New Pull Request Checklist

  • [x] I am not disclosing a vulnerability.
  • [x] I am creating this PR in reference to an issue.

Issue Description

equalTo query overrides any existing clauses before it. For e.g.

let q = new Parse.Query('MyClass');
q.greaterThan('age', 10);
q.equalTo('age', 9);
// this will override $gt query and will result something like this where: { age : 9 }

Related issue: #1372

Approach

After following through https://github.com/parse-community/Parse-SDK-JS/issues/1372 and https://github.com/parse-community/parse-php-sdk/issues/476 and https://github.com/parse-community/Parse-SDK-JS/issues/1372#issuecomment-857369919.

Using this.addCondition(key, $eq, value) instead this.where[key], so that equalTo clause can be combined with other clauses and vice-versa.

TODOs before merging

  • [x] Add tests
  • [ ] Add entry to changelog
  • [ ] Add changes to documentation (guides, repository pages, in-code descriptions)

sadakchap avatar Jun 08 '21 13:06 sadakchap

have added only a failing test case.

@sadakchap it seems you have actually also added the fix in this PR, correct? If so, is this ready for review? I would like to add the related dashboard feature with the null filter.

mtrezza avatar Sep 10 '21 16:09 mtrezza

If so, is this ready for review? I would like to add the related dashboard feature with the null filter.

Thanks @mtrezza , I think it still has some failing tests. I will try to fix those during this weekend and will let you know :slightly_smiling_face:

sadakchap avatar Sep 15 '21 02:09 sadakchap

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!

@mtrezza Thanks for following up & waiting.

About failing test cases. Only Live Query test are failing as they depend on parse-server to fire events. We will need to update parse-server to send events for $eq queries in order to fix all failing test case.

sadakchap avatar Oct 05 '21 14:10 sadakchap

Here's the pr with added support for $eq query for LiveQuery.

@mtrezza @davimacedo @dplewis, would really like to hear your thoughts about it?

sadakchap avatar Oct 05 '21 15:10 sadakchap