expense#

class src.expense.Expense(*, title: str, amount: float, id: UUID, created_at: datetime, updated_at: datetime)[source]#

Bases: BaseModel

Expense class to represent an individual financial expense.

update[source]#

update the title and/or amount of the expense. The updated_at attribute should be automatically set to the current UTC timestamp whenever an update occurs.

Parameters:
  • title (Union[str, None], optional) – the title of the expense. Defaults to None.

  • amount (Union[float, None], optional) – the amount of the expense. Defaults to None.

to_dict[source]#

Returns: Dict: a dictionary representation of the expense.