model package

Submodules

model.task module

class model.task.Task(name: str, description: str, completed: bool = False, created_at: datetime | None = None, _id: str | None = None)

Bases: object

A class to represent a Task.

_id

Unique identifier for the task.

Type:

str

name

Name of the task.

Type:

str

description

Description of the task.

Type:

str

created_at

Creation date and time of the task.

Type:

datetime

completed

Status of the task. True if completed, False otherwise.

Type:

bool

classmethod from_dict(data: Dict) Task

Create a Task object from a dictionary.

Parameters:

data (Dict[str, Union[datetime, str, bool]]) – Dictionary to create a Task from.

Returns:

A Task instance created from the provided dictionary.

Return type:

Task

to_dict() Dict

Convert Task object to dictionary.

Returns:

Dictionary representation of the Task instance.

Return type:

Dict[str, Union[datetime, str, bool]]

model.tasklist module

class model.tasklist.TaskList(title: str, tasks: List[Task] | None = None, _id: str | None = None)

Bases: object

A class to represent a TaskList.

_id

Unique identifier for the task list.

Type:

str

title

Title of the task list.

Type:

str

tasks

List of tasks in the task list.

Type:

List[Task]

classmethod from_dict(data: Dict) TaskList

Create a TaskList object from a dictionary.

Parameters:

data (Dict[str, Union[List[Task], str]]) – Dictionary to create a TaskList from.

Returns:

A TaskList instance created from the provided dictionary.

Return type:

TaskList

static get_tasklist_by_id(tasklist_id: str) TaskList | None

Retrieve a TaskList from the database by its ID.

Parameters:

tasklist_id (str) – Unique identifier of the task list.

Returns:

A TaskList instance if found, None otherwise.

Return type:

Optional[TaskList]

save() None

Save TaskList to the database.

to_dict() Dict

Convert TaskList object to dictionary.

Module contents