diff --git a/services/blob/src/http/handlers/blob.rs b/services/blob/src/http/handlers/blob.rs --- a/services/blob/src/http/handlers/blob.rs +++ b/services/blob/src/http/handlers/blob.rs @@ -85,6 +85,12 @@ blob_hash: String, } +#[derive(Deserialize, Debug)] +pub struct RemoveHolderPayload { + holder: String, + blob_hash: String, +} + #[derive(Serialize)] struct AssignHolderResponnse { data_exists: bool, @@ -246,18 +252,15 @@ Ok(HttpResponse::NoContent().finish()) } -#[instrument( - name = "delete_blob", - skip_all, - fields(holder = %params.as_ref().as_str())) -] -pub async fn delete_blob_handler( +#[instrument(name = "remove_holder", skip(ctx))] +pub async fn remove_holder_handler( ctx: web::Data, - params: web::Path, + payload: web::Json, ) -> actix_web::Result { - info!("Delete blob request"); - let holder = params.into_inner(); + info!("Remove holder request"); + let RemoveHolderPayload { holder, blob_hash } = payload.into_inner(); validate_identifier!(holder); + validate_identifier!(blob_hash); let reverse_index_item = ctx .db diff --git a/services/blob/src/http/mod.rs b/services/blob/src/http/mod.rs --- a/services/blob/src/http/mod.rs +++ b/services/blob/src/http/mod.rs @@ -54,13 +54,13 @@ .app_data(web::Data::new(ctx)) .service( web::resource("/blob/{holder}") - .route(web::get().to(handlers::blob::get_blob_handler)) - .route(web::delete().to(handlers::blob::delete_blob_handler)), + .route(web::get().to(handlers::blob::get_blob_handler)), ) .service( web::resource("/blob") .route(web::put().to(handlers::blob::upload_blob_handler)) - .route(web::post().to(handlers::blob::assign_holder_handler)), + .route(web::post().to(handlers::blob::assign_holder_handler)) + .route(web::delete().to(handlers::blob::remove_holder_handler)), ) }) .bind(("0.0.0.0", CONFIG.http_port))?