diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/jitterbug/WebService.pm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/jitterbug/WebService.pm b/lib/jitterbug/WebService.pm index d0cf92f..53d84bd 100644 --- a/lib/jitterbug/WebService.pm +++ b/lib/jitterbug/WebService.pm @@ -51,4 +51,27 @@ del '/task/:id' => sub { {status => "task $id deleted"}; }; +get '/tasks' => sub { + my $tasks = schema->resultset('Task')->search(); + + my $content; + + # I think we should never use internal ID when there is a sha256 available + while ( my $task = $tasks->next ) { + push @$content, + { + id => $task->sha256, + running => $task->running, + started_when => $task->started_when, + project => { + id => $task->projectid, + name => $task->project->name, + }, + commit => from_json($task->commit->content), + }; + } + + {tasks => $content}; +}; + 1; |