Module src.entity.memo
This module defines the Memo and MemoStatusEnum classes.
Classes
class Memo (title: str,
create_date: datetime.datetime | None = None,
update_date: datetime.datetime | None = None,
id: int | None = None)-
Expand source code
@dataclass(frozen=True) class Memo: """ An immutable memo entity. Attributes: title (str): The title of the memo. create_date (Optional[datetime]): The creation date of the memo. update_date (Optional[datetime]): The last update date of the memo. id (Optional[int]): The unique identifier for the memo. """ title: str create_date: Optional[datetime.datetime] = None update_date: Optional[datetime.datetime] = None id: Optional[int] = None def is_create(self) -> bool: """Check if the memo has been created.""" return self.id is not None def to_dict(self) -> dict: """Convert the memo to a dictionary.""" return { "id": self.id, "title": self.title, "create_date": self.create_date, "update_date": self.update_date, }An immutable memo entity.
Attributes
title:str- The title of the memo.
create_date:Optional[datetime]- The creation date of the memo.
update_date:Optional[datetime]- The last update date of the memo.
id:Optional[int]- The unique identifier for the memo.
Class variables
var create_date : datetime.datetime | Nonevar id : int | Nonevar title : strvar update_date : datetime.datetime | None
Methods
def is_create(self) ‑> bool-
Expand source code
def is_create(self) -> bool: """Check if the memo has been created.""" return self.id is not NoneCheck if the memo has been created.
def to_dict(self) ‑> dict-
Expand source code
def to_dict(self) -> dict: """Convert the memo to a dictionary.""" return { "id": self.id, "title": self.title, "create_date": self.create_date, "update_date": self.update_date, }Convert the memo to a dictionary.