websockets

This commit is contained in:
pavel 2026-02-11 16:54:44 +01:00
commit f0b53b67ce
9 changed files with 268 additions and 28 deletions

View file

@ -84,7 +84,13 @@ pub async fn create_task(
let _ = state.scheduler.add_task_job(task_id, cron).await;
}
tasks::get_task_inner(task_id, &state.db).await.map(Json)
let task_response = tasks::get_task_inner(task_id, &state.db).await?;
let _ = state
.tx
.send(crate::server::notifications::WsEvent::TaskCreated(
task_response.clone(),
));
Ok(Json(task_response))
}
pub async fn rerun_task(
@ -150,7 +156,13 @@ pub async fn update_task(
let _ = state.scheduler.remove_task_job(id).await;
}
tasks::get_task_inner(id, &state.db).await.map(Json)
let task_response = tasks::get_task_inner(id, &state.db).await?;
let _ = state
.tx
.send(crate::server::notifications::WsEvent::TaskUpdated(
task_response.clone(),
));
Ok(Json(task_response))
}
pub async fn get_task(