Refine change set
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
class ChangeSet:
|
||||
def __init__(self) -> None:
|
||||
self.added : list[dict[str, str]] = []
|
||||
self.deleted : list[dict[str, str]] = []
|
||||
self.updated : list[dict[str, str]] = []
|
||||
self.operations : list[dict[str, str]] = []
|
||||
|
||||
def add(self, type: str, id: str) -> None:
|
||||
self.added.append({ 'type': type, 'id': id })
|
||||
self.operations.append({ 'operation': 'add', 'type': type, 'id': id })
|
||||
|
||||
def delete(self, type: str, id: str) -> None:
|
||||
self.deleted.append({ 'type': type, 'id': id })
|
||||
self.operations.append({ 'operation': 'delete', 'type': type, 'id': id })
|
||||
|
||||
def update(self, type: str, id: str, property_name: str, property_type: str, property_value: str) -> None:
|
||||
self.updated.append({ 'type': type, 'id': id, 'property': property_name, 'property_type': property_type, 'property_value': property_value })
|
||||
def update(self, type: str, id: str, property: str) -> None:
|
||||
self.operations.append({ 'operation': 'update', 'type': type, 'id': id, 'property': property })
|
||||
Reference in New Issue
Block a user