create profile rpc

This commit is contained in:
Priec
2026-09-13 22:26:14 +02:00
parent dfb76b6711
commit 6548343aba
6 changed files with 127 additions and 2 deletions

Binary file not shown.

View File

@@ -1,6 +1,21 @@
// This file is @generated by prost-build.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateProfileRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
/// Omit to leave the bookkeeping currency unconfigured.
#[prost(string, optional, tag = "2")]
pub accounting_currency: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateProfileResponse {
#[prost(int64, tag = "1")]
pub profile_id: i64,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ModuleScope {
#[prost(oneof = "module_scope::Target", tags = "1, 2")]
pub target: ::core::option::Option<module_scope::Target>,
@@ -1470,6 +1485,36 @@ pub mod table_definition_client {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Creates a profile with default modules and managed structures, without a user table.
pub async fn create_profile(
&mut self,
request: impl tonic::IntoRequest<super::CreateProfileRequest>,
) -> std::result::Result<
tonic::Response<super::CreateProfileResponse>,
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/CreateProfile",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"komp_ac.table_definition.TableDefinition",
"CreateProfile",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_module_configuration(
&mut self,
request: impl tonic::IntoRequest<super::GetModuleConfigurationRequest>,
@@ -2288,6 +2333,14 @@ pub mod table_definition_server {
/// Generated trait containing gRPC methods that should be implemented for use with TableDefinitionServer.
#[async_trait]
pub trait TableDefinition: std::marker::Send + std::marker::Sync + 'static {
/// Creates a profile with default modules and managed structures, without a user table.
async fn create_profile(
&self,
request: tonic::Request<super::CreateProfileRequest>,
) -> std::result::Result<
tonic::Response<super::CreateProfileResponse>,
tonic::Status,
>;
async fn get_module_configuration(
&self,
request: tonic::Request<super::GetModuleConfigurationRequest>,
@@ -2598,6 +2651,52 @@ pub mod table_definition_server {
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/komp_ac.table_definition.TableDefinition/CreateProfile" => {
#[allow(non_camel_case_types)]
struct CreateProfileSvc<T: TableDefinition>(pub Arc<T>);
impl<
T: TableDefinition,
> tonic::server::UnaryService<super::CreateProfileRequest>
for CreateProfileSvc<T> {
type Response = super::CreateProfileResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CreateProfileRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TableDefinition>::create_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 = CreateProfileSvc(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)
}
"/komp_ac.table_definition.TableDefinition/GetModuleConfiguration" => {
#[allow(non_camel_case_types)]
struct GetModuleConfigurationSvc<T: TableDefinition>(pub Arc<T>);