From 69832e8c70609b5fe17497ac2595f7bceab64255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Wed, 6 Nov 2019 11:16:29 +0100 Subject: [PATCH] Update the http index deletion route --- meilidb-http/src/routes/index.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/meilidb-http/src/routes/index.rs b/meilidb-http/src/routes/index.rs index 85cd4b236..320c0ff48 100644 --- a/meilidb-http/src/routes/index.rs +++ b/meilidb-http/src/routes/index.rs @@ -188,15 +188,19 @@ pub async fn get_all_updates_status(ctx: Context) -> SResult { pub async fn delete_index(ctx: Context) -> SResult { ctx.is_allowed(IndexesWrite)?; - let _index_name = ctx.url_param("index")?; - let _index = ctx.index()?; + let index_name = ctx.url_param("index")?; - // ctx.state() - // .db - // .delete_index(&index_name) - // .map_err(ResponseError::internal)?; + let found = ctx + .state() + .db + .delete_index(&index_name) + .map_err(ResponseError::internal)?; - Ok(StatusCode::NOT_IMPLEMENTED) + if found { + Ok(StatusCode::OK) + } else { + Ok(StatusCode::NOT_FOUND) + } } pub fn index_update_callback(index_name: &str, data: &Data, _status: ProcessedUpdateResult) {