Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Habits #35

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Habits #35

wants to merge 8 commits into from

Conversation

Piyuuussshhh
Copy link
Owner

API

  1. fn add_habit(name: str, day_types: [(str, str)]) -> (int, map<str, (int, str)>):

    • input:
      1. name of the habit.
      2. an array of tuples containing the name and color associated to day types.
    • output: a tuple containing the id of newly created habit, and a mapping of day types to their ids.
  2. fn add_day_type(habit_id: int, dt_name: str, color: str) -> int:

    • input:
      1. the id of the habit you want to a day type to.
      2. the name of the day type.
      3. its color.
    • output: the id of the new created day type.
  3. fn fetch_habits() -> str:

    • output: all the habits in JSON format, inside an array.
  4. fn increment_streak(habit_id: int, dt_id: int):

    • input:
      1. the id of the habit completed.
      2. the day type id of today's completion.
    • NOTE: While this command does update the highest_streak of the habit if the current streak surpasses it, it does not update it in the front-end.
  5. fn delete_day_type(habit_id: int, how_many: Object):

    • input:
      1. the id of the day type you want to delete.
      2. there are two types of objects that are acceptable inputs to the how_many parameter:
        1. {to_delete: {One: dt_id}}: You want to delete one day type and its id is dt_id.
        2. {to_delete: 'All'}: You want to delete all day types.
  6. fn delete_habit(habit_id: u64):

    • input: the id of the habit you want to delete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant