Remove /experimental-features verbs that weren't in the PRD

This commit is contained in:
Louis Dureuil 2023-06-29 10:02:55 +02:00
parent 9deeec88e0
commit 68356869c0
No known key found for this signature in database

View File

@ -18,9 +18,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
cfg.service(
web::resource("")
.route(web::get().to(SeqHandler(get_features)))
.route(web::patch().to(SeqHandler(patch_features)))
.route(web::delete().to(SeqHandler(delete_features)))
.route(web::post().to(SeqHandler(post_features))),
.route(web::patch().to(SeqHandler(patch_features))),
);
}
@ -70,40 +68,3 @@ async fn patch_features(
index_scheduler.put_runtime_features(new_features)?;
Ok(HttpResponse::Ok().json(new_features))
}
async fn post_features(
index_scheduler: GuardedData<
ActionPolicy<{ actions::EXPERIMENTAL_FEATURES_UPDATE }>,
Data<IndexScheduler>,
>,
new_features: AwebJson<RuntimeTogglableFeatures, DeserrJsonError>,
analytics: Data<dyn Analytics>,
req: HttpRequest,
) -> Result<HttpResponse, ResponseError> {
let new_features = meilisearch_types::features::RuntimeTogglableFeatures {
score_details: new_features.0.score_details.unwrap_or(false),
vector_store: new_features.0.vector_store.unwrap_or(false),
};
analytics.publish("Experimental features Updated".to_string(), json!(new_features), Some(&req));
index_scheduler.put_runtime_features(new_features)?;
Ok(HttpResponse::Ok().json(new_features))
}
async fn delete_features(
index_scheduler: GuardedData<
ActionPolicy<{ actions::EXPERIMENTAL_FEATURES_UPDATE }>,
Data<IndexScheduler>,
>,
analytics: Data<dyn Analytics>,
req: HttpRequest,
) -> Result<HttpResponse, ResponseError> {
let deleted_features = Default::default();
analytics.publish(
"Experimental features Updated".to_string(),
json!(deleted_features),
Some(&req),
);
index_scheduler.put_runtime_features(deleted_features)?;
Ok(HttpResponse::Ok().json(deleted_features))
}