add: backup version converter/ backup logic 1.0

This commit is contained in:
h z
2025-04-25 13:00:41 +01:00
parent 35c8934963
commit 84494827ad
15 changed files with 2107 additions and 76 deletions

View File

@@ -1,16 +1,15 @@
from flask import Blueprint, request, jsonify
from flask import Blueprint, jsonify
from sqlalchemy.orm import Session
from sqlalchemy import and_, or_
from sqlalchemy import or_
import api
from api import etag_response, verify_token, is_user_admin
from api import etag_response, is_user_admin
from db import get_db
from db.models.Markdown import Markdown
from db.models.Path import Path
from db.models.MarkdownSetting import MarkdownSetting
from db.models.MarkdownPermissionSetting import MarkdownPermissionSetting
from api import limiter
import env_provider
import logging
logger = logging.getLogger(__name__)
@@ -67,6 +66,45 @@ def build_tree(db: Session, parent_id: int = None, is_admin=False):
@limiter.limit(api.get_rate_limit)
@etag_response
def get_tree():
"""
Get the complete tree structure of paths and markdowns.
This endpoint retrieves the hierarchical tree structure of all paths and markdowns.
For non-admin users, markdowns with 'private' permission settings are filtered out.
Returns:
A JSON object representing the tree structure with the following format:
{
"id": 1,
"name": "",
"parent_id": null,
"order": "...",
"setting_id": null,
"type": "path",
"index": true/false,
"children": [
{
"id": ...,
"title": "...",
"order": "...",
"setting_id": null,
"type": "markdown"
},
{
"id": ...,
"name": "...",
"parent_id": 1,
"order": "...",
"setting_id": null,
"type": "path",
"children": [...]
}
]
}
Response Codes:
- 200: Success
"""
is_admin = is_user_admin()
with get_db() as session: