add related stories (in api only)

This commit is contained in:
Jason Schwarzenberger
2020-11-10 14:09:56 +13:00
parent 4ec50e20cb
commit 5efc6ef2d3
3 changed files with 12 additions and 3 deletions
+3 -1
View File
@@ -99,7 +99,9 @@ def submit():
def story(sid):
story = database.get_story(sid)
if story:
res = Response(json.dumps({"story": story.data}))
related = database.get_stories_by_url(story.meta['url'])
related = [r.meta for r in related]
res = Response(json.dumps({"story": story.data, "related": related}))
res.headers['content-type'] = 'application/json'
return res
else: