implement update index

implement update index
This commit is contained in:
mpostma 2021-02-09 11:26:52 +01:00
parent f44f8a823a
commit 90b930ed7f
No known key found for this signature in database
GPG key ID: CBC8A7C1D7A28C3A
5 changed files with 135 additions and 11 deletions

View file

@ -94,11 +94,17 @@ struct UpdateIndexResponse {
#[put("/indexes/{index_uid}", wrap = "Authentication::Private")]
async fn update_index(
_data: web::Data<Data>,
_path: web::Path<IndexParam>,
_body: web::Json<IndexCreateRequest>,
data: web::Data<Data>,
path: web::Path<IndexParam>,
body: web::Json<UpdateIndexRequest>,
) -> Result<HttpResponse, ResponseError> {
todo!()
match data.update_index(&path.index_uid, body.primary_key.as_ref(), body.name.as_ref()) {
Ok(meta) => {
let json = serde_json::to_string(&meta).unwrap();
Ok(HttpResponse::Ok().body(json))
}
Err(_) => { todo!() }
}
}
#[delete("/indexes/{index_uid}", wrap = "Authentication::Private")]