fix: template defects

This commit is contained in:
h z
2025-04-18 02:16:18 +01:00
parent 0186a95dd4
commit cf247231e4

View File

@@ -34,6 +34,7 @@ def get_markdown_template(template_id):
def get_markdown_templates():
with get_db() as session:
templates = session.query(MarkdownTemplate).all()
print(templates)
return jsonify([inflate_template(template.to_dict()) for template in templates]), 200
@@ -66,10 +67,10 @@ def update_markdown_template(template_id):
return jsonify({'error': 'markdown template not found'}), 400
title = data.get("title", template.title)
parameters = data.get("parameters", template.parameters)
define = data.get("define", template.define)
layout = data.get("layout", template.layout)
template.title = title
template.parameters = parameters
template.define = define
template.layout = layout
session.commit()
if template_id in cached_templates.keys():
cached_templates[template_id] = inflate_template(template.to_dict())