Fix attribute template column name: display_order -> sort_order
This commit is contained in:
@@ -51,7 +51,7 @@ class AttributeTemplate:
|
||||
default_value: str = ""
|
||||
description: str = ""
|
||||
is_required: bool = False
|
||||
display_order: int = 0
|
||||
sort_order: int = 0
|
||||
created_at: str = ""
|
||||
updated_at: str = ""
|
||||
|
||||
@@ -655,12 +655,12 @@ class DatabaseManager:
|
||||
now = datetime.now().isoformat()
|
||||
conn.execute(
|
||||
"""INSERT INTO attribute_templates
|
||||
(id, project_id, name, type, options, default_value, description, is_required, display_order, created_at, updated_at)
|
||||
(id, project_id, name, type, options, default_value, description, is_required, sort_order, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
|
||||
(template.id, template.project_id, template.name, template.type,
|
||||
json.dumps(template.options) if template.options else None,
|
||||
template.default_value, template.description, template.is_required,
|
||||
template.display_order, now, now)
|
||||
template.sort_order, now, now)
|
||||
)
|
||||
conn.commit()
|
||||
conn.close()
|
||||
@@ -680,7 +680,7 @@ class DatabaseManager:
|
||||
conn = self.get_conn()
|
||||
rows = conn.execute(
|
||||
"""SELECT * FROM attribute_templates WHERE project_id = ?
|
||||
ORDER BY display_order, created_at""",
|
||||
ORDER BY sort_order, created_at""",
|
||||
(project_id,)
|
||||
).fetchall()
|
||||
conn.close()
|
||||
@@ -694,7 +694,7 @@ class DatabaseManager:
|
||||
|
||||
def update_attribute_template(self, template_id: str, **kwargs) -> Optional[AttributeTemplate]:
|
||||
conn = self.get_conn()
|
||||
allowed_fields = ['name', 'type', 'options', 'default_value', 'description', 'is_required', 'display_order']
|
||||
allowed_fields = ['name', 'type', 'options', 'default_value', 'description', 'is_required', 'sort_order']
|
||||
updates = []
|
||||
values = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user