mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 12:27:13 +02:00
implement clear documents
This commit is contained in:
parent
ae5581d37c
commit
a955e04ab6
3 changed files with 18 additions and 17 deletions
|
@ -250,14 +250,13 @@ async fn clear_all_documents(
|
|||
data: web::Data<Data>,
|
||||
path: web::Path<IndexParam>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
todo!()
|
||||
//match data.clear_documents(path.index_uid.clone()).await {
|
||||
//Ok(update) => {
|
||||
//let json = serde_json::to_string(&update).unwrap();
|
||||
//Ok(HttpResponse::Ok().body(json))
|
||||
//}
|
||||
//Err(e) => {
|
||||
//Ok(HttpResponse::BadRequest().body(serde_json::json!({ "error": e.to_string() })))
|
||||
//}
|
||||
//}
|
||||
match data.clear_documents(path.index_uid.clone()).await {
|
||||
Ok(update) => {
|
||||
let json = serde_json::to_string(&update).unwrap();
|
||||
Ok(HttpResponse::Ok().body(json))
|
||||
}
|
||||
Err(e) => {
|
||||
Ok(HttpResponse::BadRequest().body(serde_json::json!({ "error": e.to_string() })))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue