refactored model, fixed utf-8 export json

This commit is contained in:
2025-05-04 16:22:56 +02:00
parent 2d840d6ad4
commit 12d0d7034f
3 changed files with 32 additions and 3 deletions

View File

@@ -29,6 +29,10 @@ class Connector(ABC):
def create_new(self, values: dict) -> int:
pass
@abstractmethod
def get_all_sorted_by(self, field: str, reverse: bool = False) -> list:
pass
class JSONConnector(Connector):
def __init__(self):
@@ -78,5 +82,5 @@ class JSONConnector(Connector):
return next_id
def _write_to_file(self, data):
with open(self.json_file, "w") as f:
json.dump(data, f, indent=4)
with open(self.json_file, "w", encoding="UTF-8") as f:
json.dump(data, f, indent=4, ensure_ascii=False)