Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ross I Kinsey
where
Commits
149ce9f2
Commit
149ce9f2
authored
Feb 18, 2020
by
Zach Perkins
Browse files
Made this a GET request instead
parent
750ba0f1
Changes
1
Show whitespace changes
Inline
Side-by-side
where/app.py
View file @
149ce9f2
...
...
@@ -120,22 +120,21 @@ def get_point(session, id):
else
:
abort
(
404
)
@
app
.
route
(
'/query_points'
,
methods
=
[
'POST'
])
@
with_session
def
query_points
(
session
):
data
=
request
.
get_json
()
q
=
session
.
query
(
Point
)
if
'category'
in
data
:
q
=
q
.
filter
(
Point
.
category_id
==
data
[
'category'
])
if
'parent'
in
data
:
q
=
q
.
filter
(
Point
.
parent_id
==
data
[
'parent'
])
@
app
.
route
(
'/add-point'
)
return
jsonify
(
list
(
map
(
lambda
p
:
p
.
as_json
(),
q
.
all
())))
@
app
.
route
(
'/point'
,
methods
=
[
'GET'
])
@
with_session
def
search_points
(
session
):
q
=
session
.
query
(
Point
)
if
'category'
in
request
.
args
:
q
=
q
.
filter
(
Point
.
category_id
==
request
.
args
.
get
(
'category'
))
if
'parent'
in
request
.
args
:
q
=
q
.
filter
(
Point
.
parent_id
==
request
.
args
.
get
(
'parent'
))
return
jsonify
(
list
(
map
(
lambda
p
:
p
.
as_json
(),
q
.
limit
(
100
).
all
())))
if
__name__
==
'__main__'
:
app
.
run
()
\ No newline at end of file
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