IEEE.org
|
IEEE Xplore Digital Library
|
IEEE Standards
|
IEEE Spectrum
|
More Sites
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Open at RIT
My Conservation Life
Conservation360
Commits
4f4b209b
Unverified
Commit
4f4b209b
authored
Mar 05, 2020
by
Anthony Palumbo
Committed by
GitHub
Mar 05, 2020
Browse files
Switching Geospatial and Temporal Queries from a GET to a POST (#90)
GET to POST
parent
aac981be
Changes
5
Hide whitespace changes
Inline
Side-by-side
db/api/tests/endpoints/geometrySearch.test.js
View file @
4f4b209b
...
...
@@ -11,7 +11,7 @@ const DISTANCE_ENDPOINT = `${GEOMETRY_ENDPOINT}/distance`;
const
POLYGON_ENDPOINT
=
`
${
GEOMETRY_ENDPOINT
}
/polygon`
;
describe
(
'
GE
T assets/geometrySearch/envelope
'
,
()
=>
{
describe
(
'
POS
T assets/geometrySearch/envelope
'
,
()
=>
{
beforeAll
(
async
()
=>
{
jest
.
setTimeout
(
30000
);
await
setup
();
...
...
@@ -35,7 +35,7 @@ describe('GET assets/geometrySearch/envelope', () => {
});
await
request
(
app
)
.
ge
t
(
ENVELOPE_ENDPOINT
+
`?
${
envelopeQuery
}
`
)
.
pos
t
(
ENVELOPE_ENDPOINT
+
`?
${
envelopeQuery
}
`
)
.
expect
(
200
);
});
...
...
@@ -51,7 +51,7 @@ describe('GET assets/geometrySearch/envelope', () => {
});
await
request
(
app
)
.
ge
t
(
ENVELOPE_ENDPOINT
+
`?
${
envelopeQuery
}
`
)
.
pos
t
(
ENVELOPE_ENDPOINT
+
`?
${
envelopeQuery
}
`
)
.
expect
(
200
)
.
then
((
res
)
=>
{
expect
(
res
.
body
).
toHaveLength
(
1
);
...
...
@@ -62,7 +62,7 @@ describe('GET assets/geometrySearch/envelope', () => {
});
});
describe
(
'
GE
T assets/geometrySearch/distance
'
,
()
=>
{
describe
(
'
POS
T assets/geometrySearch/distance
'
,
()
=>
{
beforeAll
(
async
()
=>
{
jest
.
setTimeout
(
30000
);
await
setup
();
...
...
@@ -85,12 +85,12 @@ describe('GET assets/geometrySearch/distance', () => {
});
await
request
(
app
)
.
ge
t
(
DISTANCE_ENDPOINT
+
`?
${
distanceQuery
}
`
)
.
pos
t
(
DISTANCE_ENDPOINT
+
`?
${
distanceQuery
}
`
)
.
expect
(
200
);
});
});
describe
(
'
GE
T assets/geometrySearch/polygon
'
,
()
=>
{
describe
(
'
POS
T assets/geometrySearch/polygon
'
,
()
=>
{
// Helper function
let
pack
=
(
lat
,
lon
)
=>
{
return
{
latitude
:
lat
,
longitude
:
lon
};
};
...
...
@@ -114,7 +114,7 @@ describe('GET assets/geometrySearch/polygon', () => {
const
validBody
=
{
coordinates
:
[
pack
(
'
13.3
'
,
'
33
'
),
pack
(
'
12
'
,
'
44
'
),
pack
(
'
12
'
,
'
3
'
)]};
await
request
(
app
)
.
ge
t
(
POLYGON_ENDPOINT
)
.
pos
t
(
POLYGON_ENDPOINT
)
.
send
(
validBody
)
.
expect
(
200
);
});
...
...
db/api/tests/endpoints/temporal.test.js
View file @
4f4b209b
...
...
@@ -4,7 +4,7 @@ const { setup, teardown, loadSQL } = require('../setup');
const
ENDPOINT
=
'
/api/v1/assets/properties/temporalSearch
'
;
describe
(
'
GE
T assets/properties/temporalSearch
'
,
()
=>
{
describe
(
'
POS
T assets/properties/temporalSearch
'
,
()
=>
{
const
polygon_search
=
{
'
geometry
'
:
{
...
...
@@ -42,14 +42,14 @@ describe('GET assets/properties/temporalSearch', () => {
it
(
'
returns HTTP 200 with "Polygon" search
'
,
async
()
=>
{
await
request
(
app
)
.
ge
t
(
ENDPOINT
)
.
pos
t
(
ENDPOINT
)
.
send
(
polygon_search
)
.
expect
(
200
);
});
it
(
'
returns HTTP 200 with "Circle" search
'
,
async
()
=>
{
await
request
(
app
)
.
ge
t
(
ENDPOINT
)
.
pos
t
(
ENDPOINT
)
.
send
(
circle_search
)
.
expect
(
200
);
});
...
...
db/api/v1/routes/index.js
View file @
4f4b209b
...
...
@@ -17,7 +17,7 @@ const {
}
=
require
(
'
../controllers
'
);
// Geometry Searches
router
.
ge
t
(
router
.
pos
t
(
'
/assets/geometrySearch/envelope
'
,
validate
(
param
.
query
,
'
minimumLatitude
'
,
type
.
latitude
,
true
),
validate
(
param
.
query
,
'
minimumLongitude
'
,
type
.
longitude
,
true
),
...
...
@@ -27,7 +27,7 @@ router.get(
);
// Geometry Searches
router
.
ge
t
(
router
.
pos
t
(
'
/assets/geometrySearch/distance
'
,
validate
(
param
.
query
,
'
latitude
'
,
type
.
latitude
,
true
),
validate
(
param
.
query
,
'
longitude
'
,
type
.
longitude
,
true
),
...
...
@@ -35,13 +35,13 @@ router.get(
geometrySearch
.
distanceFind
);
router
.
ge
t
(
router
.
pos
t
(
'
/assets/geometrySearch/polygon
'
,
validate
(
param
.
body
,
'
coordinates
'
,
type
.
coordinates
,
true
),
geometrySearch
.
polygonFind
);
router
.
ge
t
(
router
.
pos
t
(
'
/assets/properties/temporalSearch
'
,
validate
(
param
.
body
,
'
asset_id
'
,
type
.
id
),
validate
(
param
.
body
,
'
sponsor
'
,
type
.
sponsorName
),
...
...
db/docs/geospatialTemporal.json
View file @
4f4b209b
{
"/assets/properties/temporalSearch"
:
{
"
ge
t"
:
{
"
pos
t"
:
{
"requestBody"
:
{
"description"
:
"Gets an array of assets' historical properties."
,
"content"
:
{
...
...
salesforce/my-conservation-life/force-app/main/default/lwc/geoQuery/geoQuery.js
View file @
4f4b209b
...
...
@@ -109,10 +109,10 @@ export default class GeoQuery extends LightningElement {
distanceURL
.
searchParams
.
append
(
'
longitude
'
,
`
${
mlon
}
`
);
distanceURL
.
searchParams
.
append
(
'
radiusMeters
'
,
`
${
rad
}
`
);
console
.
log
(
'
Get
ting:
'
+
distanceURL
.
href
);
console
.
log
(
'
Pos
ting
to
:
'
+
distanceURL
.
href
);
// Send out the
GET
request
this
.
assetsPromise
=
utils
.
ge
t
(
distanceURL
.
href
);
// Send out the request
this
.
assetsPromise
=
utils
.
pos
t
(
distanceURL
.
href
);
// When the promise is fulfilled handle it
this
.
assetsPromise
.
then
(
response
=>
{
...
...
@@ -143,4 +143,3 @@ export default class GeoQuery extends LightningElement {
// this.map.on('click', this.onMapClicked);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment