fix: template defects
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user