Commit 149ce9f2 authored by Zach Perkins's avatar Zach Perkins
Browse files

Made this a GET request instead

parent 750ba0f1
...@@ -120,22 +120,21 @@ def get_point(session, id): ...@@ -120,22 +120,21 @@ def get_point(session, id):
else: else:
abort(404) abort(404)
@app.route('/query_points', methods=['POST'])
@app.route('/point', methods=['GET'])
@with_session @with_session
def query_points(session): def search_points(session):
data = request.get_json()
q = session.query(Point) q = session.query(Point)
if 'category' in data: if 'category' in request.args:
q = q.filter(Point.category_id == data['category']) q = q.filter(Point.category_id == request.args.get('category'))
if 'parent' in data:
q = q.filter(Point.parent_id == data['parent'])
return jsonify(list(map(lambda p: p.as_json(), q.all()))) 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__': if __name__ == '__main__':
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment