|
@@ -1,5 +1,5 @@
|
|
|
from datetime import datetime
|
|
from datetime import datetime
|
|
|
-from sqlalchemy import Column, DateTime
|
|
|
|
|
|
|
+from sqlalchemy import Column, DateTime, inspect
|
|
|
from pydantic import ValidationError
|
|
from pydantic import ValidationError
|
|
|
|
|
|
|
|
|
|
|
|
@@ -19,18 +19,27 @@ class Base:
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
|
def to_yaml(cls, representer, node):
|
|
def to_yaml(cls, representer, node):
|
|
|
- return representer.represent_data(
|
|
|
|
|
- {k: v for k, v in node.__dict__.items() if k != '_sa_instance_state'}
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ return representer.represent_data(node.attrs)
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
|
def from_yaml(cls, constructor, node):
|
|
def from_yaml(cls, constructor, node):
|
|
|
return cls()
|
|
return cls()
|
|
|
|
|
|
|
|
|
|
+ @classmethod
|
|
|
|
|
+ def column_properties(cls):
|
|
|
|
|
+ ins = inspect(cls)
|
|
|
|
|
+ return [p.key for p in ins.iterate_properties if hasattr(p, 'columns')]
|
|
|
|
|
+
|
|
|
@property
|
|
@property
|
|
|
def short_uuid(self):
|
|
def short_uuid(self):
|
|
|
return self.uuid[:8]
|
|
return self.uuid[:8]
|
|
|
|
|
|
|
|
|
|
+ @property
|
|
|
|
|
+ def attrs(self):
|
|
|
|
|
+ return {
|
|
|
|
|
+ k: getattr(self, k) for k in self.column_properties()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
class BaseEnum:
|
|
class BaseEnum:
|
|
|
@classmethod
|
|
@classmethod
|
|
@@ -54,6 +63,7 @@ from .planned import (PlannedItem, PlannedItemType,
|
|
|
from .unplanned import (UnplannedItem, UnplannedItemType,
|
|
from .unplanned import (UnplannedItem, UnplannedItemType,
|
|
|
Idea, Experimentation)
|
|
Idea, Experimentation)
|
|
|
from .comments import Comment
|
|
from .comments import Comment
|
|
|
|
|
+from .tasks import Task
|
|
|
|
|
|
|
|
|
|
|
|
|
__all__ = [
|
|
__all__ = [
|
|
@@ -66,5 +76,6 @@ __all__ = [
|
|
|
'ItemPriority', 'Length',
|
|
'ItemPriority', 'Length',
|
|
|
'UnplannedItem', 'UnplannedItemType',
|
|
'UnplannedItem', 'UnplannedItemType',
|
|
|
'Experimentation', 'Idea',
|
|
'Experimentation', 'Idea',
|
|
|
- 'Comment'
|
|
|
|
|
|
|
+ 'Comment',
|
|
|
|
|
+ 'Task'
|
|
|
]
|
|
]
|