add: template editor
This commit is contained in:
10
api/tree.py
10
api/tree.py
@@ -2,7 +2,7 @@ from flask import Blueprint, request, jsonify
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
import api
|
||||
from api import require_auth, etag_response
|
||||
from api import etag_response
|
||||
from db import get_db
|
||||
from db.models.Markdown import Markdown
|
||||
from db.models.Path import Path
|
||||
@@ -15,7 +15,13 @@ tree_bp = Blueprint('tree', __name__, url_prefix='/api/tree')
|
||||
|
||||
def build_tree(db: Session, parent_id: int = None):
|
||||
path_nodes = db.query(Path).filter(Path.parent_id == parent_id).all()
|
||||
md_nodes = db.query(Markdown.id, Markdown.title, Markdown.order, Markdown.shortcut, Markdown.setting_id).filter(Markdown.path_id == parent_id).all()
|
||||
md_nodes = db.query(
|
||||
Markdown.id,
|
||||
Markdown.title,
|
||||
Markdown.order,
|
||||
Markdown.shortcut,
|
||||
Markdown.setting_id
|
||||
).filter(Markdown.path_id == parent_id).all()
|
||||
t0 = [
|
||||
{
|
||||
"id": node.id,
|
||||
|
||||
Reference in New Issue
Block a user