From 36c9f0599821dc5e4cfeea949bf3d1978954d91c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Wed, 26 Oct 2022 13:39:58 +0200 Subject: [PATCH] Revert "Display more than one indexUid in a task view if necessary" This reverts commit 1f2e253bb6b100a6c000218697dfdb4b4bf45532. --- meilisearch-http/src/routes/tasks.rs | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/meilisearch-http/src/routes/tasks.rs b/meilisearch-http/src/routes/tasks.rs index 544270627..41a499c20 100644 --- a/meilisearch-http/src/routes/tasks.rs +++ b/meilisearch-http/src/routes/tasks.rs @@ -32,30 +32,12 @@ pub fn configure(cfg: &mut web::ServiceConfig) { .service(web::resource("/{task_id}").route(web::get().to(SeqHandler(get_task)))); } -#[derive(Default, Debug, Clone, PartialEq, Serialize)] -#[serde(untagged, rename_all = "camelCase")] -pub enum IndexUidView { - Multiple(Vec), - Single(String), - #[default] - None, -} -impl IndexUidView { - fn new(indexes: &[&str]) -> Self { - match indexes { - [] => Self::None, - [index] => Self::Single(index.to_string()), - indexes => Self::Multiple(indexes.iter().map(ToString::to_string).collect()), - } - } -} - #[derive(Debug, Clone, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct TaskView { pub uid: TaskId, #[serde(default)] - pub index_uid: IndexUidView, + pub index_uid: Option, pub status: Status, #[serde(rename = "type")] pub kind: Kind, @@ -82,7 +64,7 @@ impl TaskView { pub fn from_task(task: &Task) -> TaskView { TaskView { uid: task.uid, - index_uid: IndexUidView::new(&task.indexes()), + index_uid: task.index_uid().map(ToOwned::to_owned), status: task.status, kind: task.kind.as_kind(), canceled_by: task.canceled_by,