fix: template defects

This commit is contained in:
h z
2025-04-17 21:44:45 +01:00
parent fa855bc7bb
commit 0186a95dd4
10 changed files with 15 additions and 24 deletions

View File

@@ -69,9 +69,10 @@ def create_markdown():
content = data.get('content')
path_id = data.get('path_id')
shortcut = data.get('shortcut', "")
setting_id = data.get('setting_id', None)
if not title or not content:
return jsonify({"error": "missing required fields"}), 400
new_markdown = Markdown(title=title, content=content, path_id=path_id, shortcut=shortcut)
new_markdown = Markdown(title=title, content=content, path_id=path_id, shortcut=shortcut, setting_id=setting_id)
with get_db() as session:
try:
if shortcut != "":
@@ -110,6 +111,7 @@ def update_markdown(markdown_id):
markdown.content = data.get('content')
markdown.path_id = data.get('path_id')
markdown.shortcut = data.get('shortcut', '')
markdown.setting_id = data.get('setting_id', None)
elif request.method == "PATCH":
if 'title' in data:
markdown.title = data.get('title')
@@ -119,6 +121,8 @@ def update_markdown(markdown_id):
markdown.path_id = data.get('path_id')
if 'shortcut' in data:
markdown.shortcut = data.get('shortcut')
if 'setting_id' in data:
markdown.setting_id = data.get('setting_id')
session.commit()
markdown_updated.send(None, payload=markdown.to_dict())
return jsonify(markdown.to_dict()), 200