From d7f748b4d6dab2535514d6777cc6301ae052fab6 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Mon, 9 May 2011 10:28:30 +0200 Subject: add a new route to the API to delete a task Signed-off-by: franck cuny --- lib/jitterbug/WebService.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib') 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; -- cgit v1.2.3