-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
withinPolygon support for Polygon object #4067
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4067 +/- ##
=========================================
+ Coverage 92.68% 92.7% +0.02%
=========================================
Files 119 119
Lines 8663 8679 +16
=========================================
+ Hits 8029 8046 +17
+ Misses 634 633 -1
Continue to review full report at Codecov.
|
spec/ParseGeoPoint.spec.js
Outdated
@@ -628,4 +738,60 @@ describe('Parse.GeoPoint testing', () => { | |||
done(); | |||
}); | |||
}); | |||
|
|||
it('support $geoIntersects queries', (done) => { |
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 test already exists
https://github.com/parse-community/parse-server/blob/master/spec/ParsePolygon.spec.js#L130
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.
Indeed it does. Duplicate removed.
I can see the tests are failing with postgres, but I'm not that well versed with that database. If someone is able to fix the tests I'd be grateful. |
if (polygon.length < 3) { | ||
let points | ||
if (typeof polygon === 'object' && polygon.__type === 'Polygon') { | ||
if (!polygon.coordinates && polygon.coordinates.length < 3) { |
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.
!polygon.coordinates || polygon.coordinates.length < 3
Using OR
here instead of AND
passes test. You might want to do the same with mongo and check your logic
fail(`no request should succeed: ${JSON.stringify(resp)}`); | ||
done(); | ||
}).catch((err) => { | ||
expect(err.error.code).toEqual(1); |
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.
Error should be 107 or Parse.Error.INVALID_JSON
@madsb ping? |
@flovilmart I added |
That sounds rad. What’s next on this one? |
@madsb How does this look? @flovilmart I think this is good to go. |
* Whitespace * Add Polygon type to $polygon query * Add tests Polygon object in $polygon query $geoIntersects queries * Refactor * Postgres support * More tests * Remove duplicate test * Missing semicolon * fix tests
This pull request add support for
Polygon
objects besides arrays ofGeoPoint
s.