delete empty profile

This commit is contained in:
Priec
2026-09-03 16:05:07 +02:00
parent bde15e7f2d
commit 0420108ff0
6 changed files with 131 additions and 2 deletions

Binary file not shown.

View File

@@ -805,6 +805,22 @@ pub struct DeleteTableResponse {
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteProfileRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteProfileResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub tables_deleted: i32,
}
/// Response describing the whole column-type vocabulary.
///
/// This is the authority a client builds its column-type picker from: every rule
@@ -1764,6 +1780,37 @@ pub mod table_definition_client {
);
self.inner.unary(req, path, codec).await
}
/// Deletes an entire profile only when none of its user or backend-managed
/// tables, audit stores, document stores, or accounting stores contain data.
pub async fn delete_profile(
&mut self,
request: impl tonic::IntoRequest<super::DeleteProfileRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteProfileResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_definition.TableDefinition/DeleteProfile",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"komp_ac.table_definition.TableDefinition",
"DeleteProfile",
),
);
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
@@ -1951,6 +1998,15 @@ pub mod table_definition_server {
tonic::Response<super::DeleteTableResponse>,
tonic::Status,
>;
/// Deletes an entire profile only when none of its user or backend-managed
/// tables, audit stores, document stores, or accounting stores contain data.
async fn delete_profile(
&self,
request: tonic::Request<super::DeleteProfileRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteProfileResponse>,
tonic::Status,
>;
}
/// The TableDefinition service manages the entire lifecycle of user-defined
/// tables (stored as both metadata and physical PostgreSQL tables) inside
@@ -2947,6 +3003,52 @@ pub mod table_definition_server {
};
Box::pin(fut)
}
"/komp_ac.table_definition.TableDefinition/DeleteProfile" => {
#[allow(non_camel_case_types)]
struct DeleteProfileSvc<T: TableDefinition>(pub Arc<T>);
impl<
T: TableDefinition,
> tonic::server::UnaryService<super::DeleteProfileRequest>
for DeleteProfileSvc<T> {
type Response = super::DeleteProfileResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DeleteProfileRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TableDefinition>::delete_profile(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteProfileSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(