add: bind path to index markdown
This commit is contained in:
@@ -25,6 +25,14 @@ def get_markdowns_by_path(path_id):
|
|||||||
with get_db() as session:
|
with get_db() as session:
|
||||||
markdowns = session.query(Markdown).filter(Markdown.path_id == path_id).all()
|
markdowns = session.query(Markdown).filter(Markdown.path_id == path_id).all()
|
||||||
return jsonify([md.to_dict() for md in markdowns]), 200
|
return jsonify([md.to_dict() for md in markdowns]), 200
|
||||||
|
@markdown_bp.route('/get_index/<int:path_id>', methods=['GET'])
|
||||||
|
@limiter.limit(api.get_rate_limit)
|
||||||
|
def get_index(path_id):
|
||||||
|
with get_db() as session:
|
||||||
|
markdown = session.query(Markdown).filter(Markdown.path_id == path_id).filter(Markdown.title == "index").first()
|
||||||
|
if markdown is None:
|
||||||
|
return jsonify({"error": "index not exist"}), 404
|
||||||
|
return jsonify(markdown.to_dict()), 200
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user