about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2011-05-09 10:28:30 +0200
committerfranck cuny <franck@lumberjaph.net>2011-05-09 16:42:15 +0200
commitd7f748b4d6dab2535514d6777cc6301ae052fab6 (patch)
tree3cbd98d68a0a09df87edf71d4dd1ccf9322633a6 /lib
parentdisplay the number of builds for the day (closes GH #53) (diff)
downloadjitterbug-d7f748b4d6dab2535514d6777cc6301ae052fab6.tar.gz
add a new route to the API to delete a task
Signed-off-by: franck cuny <franck@lumberjaph.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/jitterbug/WebService.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/jitterbug/WebService.pm b/lib/jitterbug/WebService.pm
index 65f6963..d0cf92f 100644
--- a/lib/jitterbug/WebService.pm
+++ b/lib/jitterbug/WebService.pm
@@ -36,4 +36,19 @@ get '/build/:project/:commit/:version' => sub {
     }
 };
 
+del '/task/:id' => sub {
+    my $id = params->{id};
+
+    my $task = schema->resultset('Task')->find({sha256 => $id});
+
+    if (!$task){
+        send_error("Can't find task for $id", 404);
+        return;
+    }
+
+    $task->delete;
+    status(201);
+    {status => "task $id deleted"};
+};
+
 1;