3864: Remove `/experimental-features` verbs that weren't in the PRD r=dureuill a=dureuill

Removes:

- POST `/experimental-features`
- DELETE `/experimental-features`

keeping only:

- PATCH `/experimental-features`
- GET `/experimental-features`

The two routes that are described in the PRD.

Following `@guimachiavelli's` [question](https://github.com/meilisearch/documentation/issues/2482#issuecomment-1611845372) about the POST route.

Co-authored-by: Louis Dureuil <louis@meilisearch.com>
This commit is contained in:
meili-bors[bot] 2023-06-29 09:43:14 +00:00 committed by GitHub
commit 34a07110de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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))
}