add: etag support
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from flask import Blueprint, request, jsonify
|
||||
|
||||
import api
|
||||
from api import require_auth
|
||||
from api import require_auth, etag_response
|
||||
from db import get_db
|
||||
from db.models.Markdown import Markdown
|
||||
from db.models.Path import Path
|
||||
@@ -13,6 +13,7 @@ path_bp = Blueprint('path', __name__, url_prefix='/api/path')
|
||||
|
||||
@path_bp.route('/', methods=['GET'])
|
||||
@limiter.limit(api.get_rate_limit)
|
||||
@etag_response
|
||||
def get_root_paths():
|
||||
with get_db() as session:
|
||||
paths = session.query(Path).filter(Path.parent_id == 1)
|
||||
@@ -20,6 +21,7 @@ def get_root_paths():
|
||||
|
||||
@path_bp.route('/<int:path_id>', methods=['GET'])
|
||||
@limiter.limit(api.get_rate_limit)
|
||||
@etag_response
|
||||
def get_path(path_id):
|
||||
with get_db() as session:
|
||||
path = session.query(Path).get(path_id)
|
||||
@@ -29,6 +31,7 @@ def get_path(path_id):
|
||||
|
||||
@path_bp.route('/parent/<int:parent_id>', methods=['GET'])
|
||||
@limiter.limit(api.get_rate_limit)
|
||||
@etag_response
|
||||
def get_path_by_parent(parent_id):
|
||||
with get_db() as session:
|
||||
paths = session.query(Path).filter(Path.parent_id == parent_id).all()
|
||||
|
||||
Reference in New Issue
Block a user