From 5eed2d7a4a919b3583017aa9a65089673bce87db Mon Sep 17 00:00:00 2001 From: rtkay123 Date: Thu, 14 Aug 2025 18:13:31 +0200 Subject: feat(config): routing mutation --- .../http_svc/routes/routing/delete_routing.rs | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 crates/configuration/src/server/http_svc/routes/routing/delete_routing.rs (limited to 'crates/configuration/src/server/http_svc/routes/routing/delete_routing.rs') diff --git a/crates/configuration/src/server/http_svc/routes/routing/delete_routing.rs b/crates/configuration/src/server/http_svc/routes/routing/delete_routing.rs new file mode 100644 index 0000000..07148cc --- /dev/null +++ b/crates/configuration/src/server/http_svc/routes/routing/delete_routing.rs @@ -0,0 +1,41 @@ +use axum::extract::{Path, State}; +use tonic::IntoRequest; +use warden_core::configuration::routing::{ + DeleteConfigurationRequest, RoutingConfiguration, mutate_routing_server::MutateRouting, +}; + +use crate::{ + server::{error::AppError, http_svc::TAG_ROUTING, version::Version}, + state::AppHandle, +}; + +/// Delete routing configuration +#[utoipa::path( + delete, + path = "/{version}/routing/{id}", + responses(( + status = OK, + body = RoutingConfiguration + )), + operation_id = "delete_routing_configuration", // https://github.com/juhaku/utoipa/issues/1170 + params( + ("version" = Version, Path, description = "API version, e.g., v1, v2, v3"), + ("id" = String, Path, description = "Identifier for item to delete"), + ), + tag = TAG_ROUTING, + ) +] +#[axum::debug_handler] +#[tracing::instrument(skip(state))] +pub async fn delete( + State(state): State, + Path(id): Path, + axum::Json(body): axum::Json, +) -> Result, AppError> { + let body = state + .delete_routing_configuration(DeleteConfigurationRequest { id }.into_request()) + .await? + .into_inner(); + + Ok(axum::Json(body)) +} -- cgit v1.2.3