Skip to content

Instantly share code, notes, and snippets.

@opalczynski
Created October 5, 2021 14:33
Show Gist options
  • Select an option

  • Save opalczynski/2d8289f9335116d856ce67b18c4979ef to your computer and use it in GitHub Desktop.

Select an option

Save opalczynski/2d8289f9335116d856ce67b18c4979ef to your computer and use it in GitHub Desktop.
Final version of data.py for CLI
from dataclasses import dataclass
from typing import Union
from constants import TaskStatusE
@dataclass
class Project:
id: Union[int, None] # this is because when creating we do not have the ID yet
name: str
description: Union[str, None] # description is optional
@dataclass
class Task:
id: Union[int, None] # this is because when creating we do not have the ID yet
title: str
description: Union[str, None] # description is optional
status: int
project_id: int
def get_display_status(self):
return TaskStatusE(self.status).name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment