Update worker
This commit is contained in:
+14
@@ -169,4 +169,18 @@ post '/api/v1/task/:task/complete' => sub {
|
||||
return { message => "Task completed successfully" };
|
||||
};
|
||||
|
||||
post '/api/v1/task' => sub {
|
||||
my $video_id = body_parameters->get("video_id");
|
||||
my $task_type = body_parameters->get("task_type");
|
||||
|
||||
database->do("DELETE FROM tasks WHERE video_id=? AND task_type=?", undef, $video_id, $task_type);
|
||||
|
||||
my $sth = database->prepare("INSERT INTO tasks (video_id, task_type, status) VALUES (?, ?, 'PENDING')");
|
||||
$sth->execute($video_id, $task_type);
|
||||
my $task_id = database->last_insert_id(undef, undef, 'tasks', undef);
|
||||
$sth->finish();
|
||||
|
||||
return { id => $task_id };
|
||||
};
|
||||
|
||||
start();
|
||||
Reference in New Issue
Block a user