X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=plomtask%2Fdays.py;fp=plomtask%2Fdays.py;h=a924bbfeadd2bd895d2f21ac4b7487305fbe771f;hb=db62e6559fdd577dae38d4b6f5cbd5ef6a14cc57;hp=afe4a01be6f509a8b624da7c45650500a96805e2;hpb=a658d31f985ec9a08181005614c3d9876e046274;p=plomtask diff --git a/plomtask/days.py b/plomtask/days.py index afe4a01..a924bbf 100644 --- a/plomtask/days.py +++ b/plomtask/days.py @@ -23,6 +23,13 @@ class Day(BaseModel[str]): def __lt__(self, other: Day) -> bool: return self.date < other.date + @property + def as_dict(self) -> dict[str, object]: + """Return self as (json.dumps-coompatible) dict.""" + d = super().as_dict + d['todos'] = [t.as_dict for t in self.todos] + return d + @classmethod def from_table_row(cls, db_conn: DatabaseConnection, row: Row | list[Any] ) -> Day: