feat: Background tasks table + tasks route migrated to Rust

- New migration: background_tasks table
- New model: BackgroundTask (background_task.rs)
- GET /api/tasks with limit param
- GET /api/tasks/{id} with 404 handling
- 18/18 tests pass
This commit is contained in:
boos
2026-05-17 16:56:15 +08:00
parent d7d3670f02
commit fac1aa4a88
5 changed files with 116 additions and 0 deletions
@@ -0,0 +1,25 @@
use serde::{Deserialize, Serialize};
use sqlx::FromRow;
/// Background task for tracking async operations (deployments, syncs, etc.)
#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
pub struct BackgroundTask {
pub id: String,
pub task_type: String,
pub title: String,
pub status: String,
pub message: Option<String>,
pub error: Option<String>,
pub dedupe_key: Option<String>,
pub success_title: Option<String>,
pub failure_title: Option<String>,
pub notify_on_success: Option<bool>,
pub notify_on_failure: Option<bool>,
pub result_json: Option<String>,
pub progress: Option<i64>,
pub progress_total: Option<i64>,
pub created_at: Option<String>,
pub updated_at: Option<String>,
pub started_at: Option<String>,
pub finished_at: Option<String>,
}
+1
View File
@@ -7,5 +7,6 @@ pub mod route_channel;
pub mod setting;
pub mod site;
pub mod site_announcement;
pub mod background_task;
pub mod token_route;
pub mod user;