Code refactor for change set
This commit is contained in:
@@ -10,7 +10,7 @@ def get_backdrop(name: str) -> dict[str, Any]:
|
||||
return { 'content': e['content'] }
|
||||
|
||||
|
||||
def set_backdrop_cache(name: str, cs: ChangeSet) -> SqlChangeSet:
|
||||
def set_backdrop_cache(name: str, cs: ChangeSet) -> DbChangeSet:
|
||||
old = get_backdrop(name)
|
||||
|
||||
redo_sql = f"update backdrop set content = '{cs.operations[0]['content']}' where content = '{old['content']}';"
|
||||
@@ -19,7 +19,7 @@ def set_backdrop_cache(name: str, cs: ChangeSet) -> SqlChangeSet:
|
||||
redo_cs = g_update_prefix | { 'type': 'backdrop', 'content': cs.operations[0]['content'] }
|
||||
undo_cs = g_update_prefix | { 'type': 'backdrop', 'content': old['content'] }
|
||||
|
||||
return SqlChangeSet(redo_sql, undo_sql, redo_cs, undo_cs)
|
||||
return DbChangeSet(redo_sql, undo_sql, [redo_cs], [undo_cs])
|
||||
|
||||
|
||||
def set_backdrop(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
|
||||
Reference in New Issue
Block a user