Verified Commit d4b057dd authored by Egor Dubenetskiy's avatar Egor Dubenetskiy 🚴🏼

Реализовать GET для постов

parent 810700a6
......@@ -41,7 +41,6 @@ def init(app):
@app.route('/api/posts/<int:id>', methods=['GET'])
def api_posts_get(id):
# TODO: Obtain data from database
try:
post = Post[id]
return json.dumps({
......@@ -53,10 +52,12 @@ def init(app):
'source': post.source,
'photo': post.photo,
'video': post.video,
# TODO: Store latitude and longitude directly in the record maybe?
'location': post.location.to_json,
'author': 70127420,
'state': 'published',
'location': {
'latitude': post.latitude,
'longitude': post.longitude,
},
'author': post.author,
'state': post.state,
}
})
except orm.core.ObjectNotFound:
......
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