mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
implements the get_tasks
This commit is contained in:
parent
5b282acb7b
commit
f84cbee170
7 changed files with 131 additions and 22 deletions
|
@ -156,6 +156,8 @@ async fn get_task(
|
|||
req: HttpRequest,
|
||||
analytics: web::Data<dyn Analytics>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
let task_id = task_id.into_inner();
|
||||
|
||||
analytics.publish(
|
||||
"Tasks Seen".to_string(),
|
||||
json!({ "per_task_uid": true }),
|
||||
|
@ -170,10 +172,11 @@ async fn get_task(
|
|||
}
|
||||
}
|
||||
|
||||
filters.limit = 1;
|
||||
filters.from = Some(*task_id);
|
||||
filters.uid = Some(vec![task_id]);
|
||||
|
||||
let task = meilisearch.list_tasks(filters).await?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(task))
|
||||
if let Some(task) = meilisearch.list_tasks(filters).await?.first() {
|
||||
Ok(HttpResponse::Ok().json(task))
|
||||
} else {
|
||||
Err(index_scheduler::Error::TaskNotFound(task_id).into())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue