Split frontend model from backend model
All checks were successful
Build Formula10 Docker Image / build-docker (push) Successful in 26s

This commit is contained in:
2024-02-25 15:09:59 +01:00
parent a9b1bc4403
commit 991a1a177e
38 changed files with 1094 additions and 930 deletions

View File

@ -0,0 +1,30 @@
from urllib.parse import quote
from formula10.database.model.db_team import DbTeam
class Team():
@classmethod
def from_db_team(cls, db_team: DbTeam):
team: Team = cls()
team.name = db_team.name
return team
def to_db_team(self) -> DbTeam:
db_team: DbTeam = DbTeam(name=self.name)
return db_team
def __eq__(self, __value: object) -> bool:
if isinstance(__value, Team):
return self.name == __value.name
return NotImplemented
name: str
@property
def name_sanitized(self) -> str:
return quote(self.name)
NONE_TEAM: Team = Team()
NONE_TEAM.name = "None"