mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 14:54:27 +01:00
HTTP delete index route; Fix error on index not found
This commit is contained in:
parent
5ad73fe08b
commit
6edef07e29
@ -390,19 +390,10 @@ pub async fn get_all_updates_status(ctx: Context<Data>) -> SResult<Response> {
|
|||||||
|
|
||||||
pub async fn delete_index(ctx: Context<Data>) -> SResult<StatusCode> {
|
pub async fn delete_index(ctx: Context<Data>) -> SResult<StatusCode> {
|
||||||
ctx.is_allowed(IndexesWrite)?;
|
ctx.is_allowed(IndexesWrite)?;
|
||||||
|
let _ = ctx.index()?;
|
||||||
let index_uid = ctx.url_param("index")?;
|
let index_uid = ctx.url_param("index")?;
|
||||||
|
ctx.state().db.delete_index(&index_uid).map_err(ResponseError::internal)?;
|
||||||
let found = ctx
|
Ok(StatusCode::NO_CONTENT)
|
||||||
.state()
|
|
||||||
.db
|
|
||||||
.delete_index(&index_uid)
|
|
||||||
.map_err(ResponseError::internal)?;
|
|
||||||
|
|
||||||
if found {
|
|
||||||
Ok(StatusCode::NO_CONTENT)
|
|
||||||
} else {
|
|
||||||
Ok(StatusCode::NOT_FOUND)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn index_update_callback(index_uid: &str, data: &Data, status: ProcessedUpdateResult) {
|
pub fn index_update_callback(index_uid: &str, data: &Data, status: ProcessedUpdateResult) {
|
||||||
|
Loading…
Reference in New Issue
Block a user