Last active
February 6, 2023 00:25
-
-
Save gsastry/8f7b9154ef5626f5b8d9e441b21779f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TaskStatus = Not Started | InProgress | Done | |
# InProgress = { tags: List[Tag] } | |
# | |
# Tag | |
# UnderReview instance of Tag | |
# Blocked instance of Tag | |
# TaskPriority = High | Medium | Low | |
# Task: | |
# status: TaskStatus | |
# content: str | |
# priority: Optional[TaskPriority] | |
# visibility: Visibility = Private | |
# | |
# mark_done() | |
# self._set_status(TaskStatus.Done) | |
# | |
# mark_started() | |
# self._set_status(TaskStatus.InProgress) | |
# toggle_priority() | |
# self.priority = Some(next state in priority) | |
# | |
# edit_content(new_content: str) | |
# self.content = new_content | |
# | |
# _set_status(new_status: TaskStatus) | |
# self.status = new_status | |
# | |
# change_vis(new_vis: Visibility) | |
# self.visibility = new_vis | |
# | |
# | |
# TodoListWithHistory derives Shareable and History: | |
# tasks: List[Task] | |
# get_tasks(priority: Optional[Priority]) | |
# <implementation> | |
# create_task(task: Task) | |
# <implementation> | |
# remove_task(task: Task) | |
# <implementation> | |
# TodoList derives Shareable and History: | |
# tasks: List[Task] | |
# get_tasks(priority: Optional[Priority]) | |
# <implementation> | |
# create_task(task: Task) | |
# <implementation> | |
# remove_task(task: Task) | |
# <implementation> | |
# trait History | |
# created_at | |
# updated_at | |
# | |
# If a TodoList implements History, then modify the create and add tasks | |
# functions to update the created_at and updated_at | |
# Current TodoLists won't implement this trait, so it won't work for them | |
# (This feels very ugly) | |
# User: | |
# username: str | |
# friends: list[User] | |
# todolist: TodoList | |
# Visibility = Public | Private (for tasks) | |
# trait Shareable | |
# share_with(user: User) | |
# <implemenation> | |
# stop_sharing_with(user: User) | |
# <implemenation> | |
# shared_with() -> list[User] | |
# <implemenation> | |
# UI: To view a Friend's todolist could have: | |
# - Dropdown of friends | |
# - Select a friend, subselect viewable todo lists | |
# - Repopulate currently viewed TODO list | |
# - So could just reuse that code | |
# | |
# To extend to show counts, can add a function that counts currently displayed tasks. | |
# However, important to only count currently displayed tasks, as then they are guaranteed | |
# to be properly permissioned and won't leak any extra information | |
# to the user. | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment