update the settings routes

This commit is contained in:
tamo 2021-03-29 20:19:37 +02:00
parent 96cffeab1e
commit 79c63049d7
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69
2 changed files with 9 additions and 2 deletions

View File

@ -43,6 +43,9 @@ pub struct Settings {
skip_serializing_if = "Option::is_none"
)]
pub ranking_rules: Option<Option<Vec<String>>>,
// TODO we are missing the stopWords, synonyms and distinctAttribute for the GET settings
// request
}
impl Settings {

View File

@ -131,7 +131,9 @@ async fn update_all(
.update_settings(index_uid.into_inner(), body.into_inner(), true)
.await
{
Ok(update_result) => Ok(HttpResponse::Accepted().json(update_result)),
Ok(update_result) => {
Ok(HttpResponse::Accepted().json(serde_json::json!({ "updateId": update_result.id() })))
}
Err(e) => {
Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() })))
}
@ -161,7 +163,9 @@ async fn delete_all(
.update_settings(index_uid.into_inner(), settings, false)
.await
{
Ok(update_result) => Ok(HttpResponse::Accepted().json(update_result)),
Ok(update_result) => {
Ok(HttpResponse::Accepted().json(serde_json::json!({ "updateId": update_result.id() })))
}
Err(e) => {
Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() })))
}