refactored model, fixed utf-8 export json
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user