aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/database/v2/handlers.py3
-rw-r--r--api/resources/v2/tasks.py10
2 files changed, 13 insertions, 0 deletions
diff --git a/api/database/v2/handlers.py b/api/database/v2/handlers.py
index 44c14df61..1bc32bf0e 100644
--- a/api/database/v2/handlers.py
+++ b/api/database/v2/handlers.py
@@ -173,6 +173,9 @@ class V2ProjectHandler(object):
class V2TaskHandler(object):
+ def list_all(self):
+ return V2Task.query.all()
+
def insert(self, kwargs):
task = V2Task(**kwargs)
db_session.add(task)
diff --git a/api/resources/v2/tasks.py b/api/resources/v2/tasks.py
index 0eb95773a..9790d7640 100644
--- a/api/resources/v2/tasks.py
+++ b/api/resources/v2/tasks.py
@@ -21,6 +21,16 @@ LOG.setLevel(logging.DEBUG)
class V2Tasks(ApiResource):
+ def get(self):
+ task_handler = V2TaskHandler()
+ tasks = [change_obj_to_dict(t) for t in task_handler.list_all()]
+
+ for t in tasks:
+ result = t['result']
+ t['result'] = jsonutils.loads(result) if result else None
+
+ return result_handler(consts.API_SUCCESS, {'tasks': tasks})
+
def post(self):
return self._dispatch_post()