-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Added 'withinPolygon' to query #3866
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3866 +/- ##
==========================================
+ Coverage 90.17% 90.22% +0.05%
==========================================
Files 114 114
Lines 7550 7571 +21
==========================================
+ Hits 6808 6831 +23
+ Misses 742 740 -2
Continue to review full report at Codecov.
|
Hi @dplewis Thanks for this PR! That'S great that you jump in on such requested feature! Would you please add some unit tests to cover this feature? The best location would be here where other geoPoints tests are run. If you can add a tests that covers:
Because the JS SDK doesn't have the within polygon yet, you should use request and craft the query directly as a REST request. You can find an example query request here |
Test have been added |
Can we add a test with invalid points within the polygon array?
|
Sorry for the late reply. I've added more tests |
Quick question when writing test do the test objects get deleted before and after the Unit Tests |
Yes, the whole DB is cleaned up between tests |
Interesting at one point the test passed the first time but second and third, etc failed until I deleted all objects. |
Seems that it's not properly supported on Postgres. Can you check the Travis logs? |
How do I go about running tests against Postgres |
You can disable the Postgres test for now with it_exclude_db() (Check in other tests for the exact syntax)
You'll need Postgres installed and configured (as in the .travis.yaml) |
I got the test to pass locally with postgres |
Can you create add testing Postgres to I can try to help out on the Postgres Adapter. |
I'll work on the contributing guidelines :) |
@@ -10,6 +10,7 @@ const PostgresDuplicateObjectError = '42710'; | |||
const PostgresUniqueIndexViolationError = '23505'; | |||
const PostgresTransactionAbortedError = '25P02'; | |||
const logger = require('../../../logger'); | |||
const _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
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.
does that come from transpired babel source? please remove :)
throw new Parse.Error(Parse.Error.INVALID_JSON, 'bad $geoWithin value'); | ||
} | ||
const points = polygon.map((point) => { | ||
if (!((typeof point === 'undefined' ? 'undefined' : _typeof(point)) === 'object' && point !== null && point.__type === 'GeoPoint')) { |
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.
doesn't seem to be something a human would write :)
can we replace with:
if (typeof point !== 'object' || point.__type !== 'GeoPoint') {
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.
Good thing I'm not human
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.
Sorry if I offended you, it looked like generated code
@dplewis just one small nit, otherwise it's looking awesome! |
Thanks, when can we update the SDKs? Also theres a debug function in PostgresAdapter. How do I run that? |
With |
@dplewis we can update the SDK's anytime, on old parse-server versions that will just fail as unsupported queries, with next release, this should work nicely |
Holy smokes, this looks awesome - can't wait to try it out. Thanks, @dplewis! 🙏🏼 |
@dplewis will you be updating the iOS SDK with this aswell? |
@otymartin I'm working on it now should be there soon |
@dplewis nice to see this bumping along! Has the android sdk received this yet by chance? |
@dplewis nice thanks man |
This PR addresses issue #3290
My first PR any help would be great.
I don't know much about Postgres. Is there a guide to setup Postgres with parse server locally?