|
|
@@ -12,6 +12,7 @@ class Item(SchemaMixin, DbMixin):
|
|
|
document: dict
|
|
|
name: str
|
|
|
description: str
|
|
|
+ category: str
|
|
|
milestone: Milestone
|
|
|
sprint: Sprint
|
|
|
date_added: datetime = None
|
|
|
@@ -30,13 +31,29 @@ class Item(SchemaMixin, DbMixin):
|
|
|
description:
|
|
|
required: true
|
|
|
type: string
|
|
|
+ category:
|
|
|
+ required: true
|
|
|
+ type: string
|
|
|
+ allowed:
|
|
|
+ - feature
|
|
|
+ - limitation
|
|
|
+ - constraint
|
|
|
+ - unknown
|
|
|
milestone_id:
|
|
|
is_fk: milestone
|
|
|
+ excludes: sprint_id
|
|
|
+ required: true
|
|
|
sprint_id:
|
|
|
is_fk: sprint
|
|
|
+ excludes: milestone_id
|
|
|
+ required: true
|
|
|
date_added:
|
|
|
type: datetime
|
|
|
default_setter: utcnow
|
|
|
+ date_expected:
|
|
|
+ type: date
|
|
|
+ date_started:
|
|
|
+ type: date
|
|
|
"""
|
|
|
|
|
|
@classmethod
|
|
|
@@ -44,10 +61,36 @@ class Item(SchemaMixin, DbMixin):
|
|
|
kwargs = deepcopy(document)
|
|
|
milestone = Milestone.fetch(kwargs.pop('milestone_id', None))
|
|
|
sprint = Sprint.fetch(kwargs.pop('sprint_id', None))
|
|
|
- return cls(document=document, milestone=milestone, sprint=sprint, **kwargs)
|
|
|
+
|
|
|
+ category_to_kls = {
|
|
|
+ 'feature': Feature,
|
|
|
+ 'limitation': Limitation,
|
|
|
+ 'constraint': Constraint,
|
|
|
+ 'unknown': Unknown,
|
|
|
+ }
|
|
|
+
|
|
|
+ kls = category_to_kls[kwargs.get('category')]
|
|
|
+
|
|
|
+ return kls(document=document, milestone=milestone, sprint=sprint, **kwargs)
|
|
|
|
|
|
def __repr__(self):
|
|
|
return "{}(name='{}', milestone='{}')".format(self.__class__.__qualname__, self.name, repr(self.milestone))
|
|
|
|
|
|
def __terminal__(self):
|
|
|
- return f"Item : {self.name} ({self.sprint or self.milestone})"
|
|
|
+ return f"{self.__class__.__qualname__} : {self.name} ({self.sprint or self.milestone})"
|
|
|
+
|
|
|
+
|
|
|
+class Limitation(Item):
|
|
|
+ ...
|
|
|
+
|
|
|
+
|
|
|
+class Feature(Item):
|
|
|
+ ...
|
|
|
+
|
|
|
+
|
|
|
+class Constraint(Item):
|
|
|
+ ...
|
|
|
+
|
|
|
+
|
|
|
+class Unknown(Item):
|
|
|
+ ...
|