feat: add mapper for student and it loads

This commit is contained in:
2022-12-26 11:21:05 +01:00
parent 6f486a6f3c
commit 2444bf38a1
4 changed files with 61 additions and 6 deletions

View File

@@ -20,3 +20,6 @@ class Student:
if isinstance(other, Student):
return self.id == other.id
return False
def __hash__(self) -> int:
return hash(self.id)

View File

@@ -26,8 +26,5 @@ class Tribe:
return self.name == other.name
return False
def __repr__(self) -> str:
return f"<Tribe {self.name=}>"
def to_dict(self) -> dict:
return {"name": self.name, "level": self.level}