Update worker

This commit is contained in:
Ryan Shpeherd
2026-09-09 13:50:19 -04:00
parent d9c0998400
commit 9f098d4b1f
6 changed files with 675 additions and 2 deletions
+14
View File
@@ -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();