create profile rpc
This commit is contained in:
Submodule client-gui2 updated: fb0322b75f...e3798fc82f
@@ -9,6 +9,9 @@ import "common.proto";
|
|||||||
// logical "profiles" (schemas). Each table has stored structure, links, and
|
// logical "profiles" (schemas). Each table has stored structure, links, and
|
||||||
// validation rules.
|
// validation rules.
|
||||||
service TableDefinition {
|
service TableDefinition {
|
||||||
|
// Creates a profile with default modules and managed structures, without a user table.
|
||||||
|
rpc CreateProfile(CreateProfileRequest) returns (CreateProfileResponse);
|
||||||
|
|
||||||
rpc GetModuleConfiguration(GetModuleConfigurationRequest) returns (ModuleConfiguration);
|
rpc GetModuleConfiguration(GetModuleConfigurationRequest) returns (ModuleConfiguration);
|
||||||
rpc SetModuleConfiguration(SetModuleConfigurationRequest) returns (ModuleConfiguration);
|
rpc SetModuleConfiguration(SetModuleConfigurationRequest) returns (ModuleConfiguration);
|
||||||
|
|
||||||
@@ -108,6 +111,16 @@ service TableDefinition {
|
|||||||
rpc DeleteProfile(DeleteProfileRequest) returns (DeleteProfileResponse);
|
rpc DeleteProfile(DeleteProfileRequest) returns (DeleteProfileResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message CreateProfileRequest {
|
||||||
|
string profile_name = 1;
|
||||||
|
// Omit to leave the bookkeeping currency unconfigured.
|
||||||
|
optional string accounting_currency = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateProfileResponse {
|
||||||
|
int64 profile_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
message ModuleScope {
|
message ModuleScope {
|
||||||
oneof target {
|
oneof target {
|
||||||
komp_ac.common.Empty defaults = 1;
|
komp_ac.common.Empty defaults = 1;
|
||||||
|
|||||||
Binary file not shown.
@@ -1,6 +1,21 @@
|
|||||||
// This file is @generated by prost-build.
|
// This file is @generated by prost-build.
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
#[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 {
|
pub struct ModuleScope {
|
||||||
#[prost(oneof = "module_scope::Target", tags = "1, 2")]
|
#[prost(oneof = "module_scope::Target", tags = "1, 2")]
|
||||||
pub target: ::core::option::Option<module_scope::Target>,
|
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.inner = self.inner.max_encoding_message_size(limit);
|
||||||
self
|
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(
|
pub async fn get_module_configuration(
|
||||||
&mut self,
|
&mut self,
|
||||||
request: impl tonic::IntoRequest<super::GetModuleConfigurationRequest>,
|
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.
|
/// Generated trait containing gRPC methods that should be implemented for use with TableDefinitionServer.
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait TableDefinition: std::marker::Send + std::marker::Sync + 'static {
|
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(
|
async fn get_module_configuration(
|
||||||
&self,
|
&self,
|
||||||
request: tonic::Request<super::GetModuleConfigurationRequest>,
|
request: tonic::Request<super::GetModuleConfigurationRequest>,
|
||||||
@@ -2598,6 +2651,52 @@ pub mod table_definition_server {
|
|||||||
}
|
}
|
||||||
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
||||||
match req.uri().path() {
|
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" => {
|
"/komp_ac.table_definition.TableDefinition/GetModuleConfiguration" => {
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
struct GetModuleConfigurationSvc<T: TableDefinition>(pub Arc<T>);
|
struct GetModuleConfigurationSvc<T: TableDefinition>(pub Arc<T>);
|
||||||
|
|||||||
@@ -1405,6 +1405,19 @@ impl GrpcClient {
|
|||||||
.into_inner())
|
.into_inner())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn create_profile(
|
||||||
|
&mut self,
|
||||||
|
req: common::proto::komp_ac::table_definition::CreateProfileRequest,
|
||||||
|
) -> Result<common::proto::komp_ac::table_definition::CreateProfileResponse> {
|
||||||
|
let request = self.authenticated_request(req)?;
|
||||||
|
Ok(self
|
||||||
|
.table_definition_client
|
||||||
|
.create_profile(request)
|
||||||
|
.await
|
||||||
|
.context("gRPC CreateProfile call failed")?
|
||||||
|
.into_inner())
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn copy_profile(
|
pub async fn copy_profile(
|
||||||
&mut self,
|
&mut self,
|
||||||
request: common::proto::komp_ac::table_definition::CopyProfileRequest,
|
request: common::proto::komp_ac::table_definition::CopyProfileRequest,
|
||||||
|
|||||||
2
server
2
server
Submodule server updated: 395cfd1644...de6f24fdbd
Reference in New Issue
Block a user