diff --git a/common/build.rs b/common/build.rs index 02cc87c..323746b 100644 --- a/common/build.rs +++ b/common/build.rs @@ -173,14 +173,6 @@ fn main() -> Result<(), Box> { ".komp_ac.table_definition.MoneyColumnOptions", "#[derive(serde::Serialize, serde::Deserialize)]", ) - .type_attribute( - ".komp_ac.table_definition.PostMoneyTableDefinitionRequest", - "#[derive(serde::Serialize, serde::Deserialize)]", - ) - .type_attribute( - ".komp_ac.table_definition.AddMoneyTableColumnsRequest", - "#[derive(serde::Serialize, serde::Deserialize)]", - ) .type_attribute( ".komp_ac.table_definition.TableDefinitionResponse", "#[derive(serde::Serialize, serde::Deserialize)]" diff --git a/common/proto/table_definition.proto b/common/proto/table_definition.proto index 5995529..fd0110a 100644 --- a/common/proto/table_definition.proto +++ b/common/proto/table_definition.proto @@ -14,16 +14,10 @@ service TableDefinition { // Also inserts metadata and default validation rules. Entirely transactional. rpc PostTableDefinition(PostTableDefinitionRequest) returns (TableDefinitionResponse); - // Creates a table using the money-aware definition contract. - rpc PostMoneyTableDefinition(PostMoneyTableDefinitionRequest) returns (TableDefinitionResponse); - // Appends new user-defined columns to an existing table. // Existing columns, links, and table logic are never changed by this call. rpc AddTableColumns(AddTableColumnsRequest) returns (TableDefinitionResponse); - // Adds columns using the money-aware definition contract. - rpc AddMoneyTableColumns(AddMoneyTableColumnsRequest) returns (TableDefinitionResponse); - // Lists all profiles (schemas) and their tables with declared dependencies. // This provides a tree-like overview of table relationships. rpc GetProfileTree(komp_ac.common.Empty) returns (ProfileTreeResponse); @@ -84,12 +78,9 @@ message PostTableDefinitionRequest { // like "public", "information_schema", or ones starting with "pg_". string profile_name = 5; -} + string base_currency = 6; + repeated MoneyColumnOptions money_columns = 7; -message PostMoneyTableDefinitionRequest { - PostTableDefinitionRequest definition = 1; - string base_currency = 2; - repeated MoneyColumnOptions money_columns = 3; } // Defines append-only column additions for an existing table. @@ -106,12 +97,9 @@ message AddTableColumnsRequest { // Optional indexes for the new columns only. repeated string indexes = 4; -} + repeated MoneyColumnOptions money_columns = 5; + string base_currency = 6; -message AddMoneyTableColumnsRequest { - AddTableColumnsRequest definition = 1; - repeated MoneyColumnOptions money_columns = 2; - string base_currency = 3; } enum MoneyRounding { diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index 79df9f5..c1e613a 100644 Binary files a/common/src/proto/descriptor.bin and b/common/src/proto/descriptor.bin differ diff --git a/common/src/proto/komp_ac.table_definition.rs b/common/src/proto/komp_ac.table_definition.rs index 3649e2b..c7de2fa 100644 --- a/common/src/proto/komp_ac.table_definition.rs +++ b/common/src/proto/komp_ac.table_definition.rs @@ -42,15 +42,9 @@ pub struct PostTableDefinitionRequest { /// like "public", "information_schema", or ones starting with "pg\_". #[prost(string, tag = "5")] pub profile_name: ::prost::alloc::string::String, -} -#[derive(serde::Serialize, serde::Deserialize)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct PostMoneyTableDefinitionRequest { - #[prost(message, optional, tag = "1")] - pub definition: ::core::option::Option, - #[prost(string, tag = "2")] + #[prost(string, tag = "6")] pub base_currency: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "3")] + #[prost(message, repeated, tag = "7")] pub money_columns: ::prost::alloc::vec::Vec, } /// Defines append-only column additions for an existing table. @@ -69,15 +63,9 @@ pub struct AddTableColumnsRequest { /// Optional indexes for the new columns only. #[prost(string, repeated, tag = "4")] pub indexes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -#[derive(serde::Serialize, serde::Deserialize)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AddMoneyTableColumnsRequest { - #[prost(message, optional, tag = "1")] - pub definition: ::core::option::Option, - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag = "5")] pub money_columns: ::prost::alloc::vec::Vec, - #[prost(string, tag = "3")] + #[prost(string, tag = "6")] pub base_currency: ::prost::alloc::string::String, } #[derive(serde::Serialize, serde::Deserialize)] @@ -460,36 +448,6 @@ pub mod table_definition_client { ); self.inner.unary(req, path, codec).await } - /// Creates a table using the money-aware definition contract. - pub async fn post_money_table_definition( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - 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/PostMoneyTableDefinition", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "komp_ac.table_definition.TableDefinition", - "PostMoneyTableDefinition", - ), - ); - self.inner.unary(req, path, codec).await - } /// Appends new user-defined columns to an existing table. /// Existing columns, links, and table logic are never changed by this call. pub async fn add_table_columns( @@ -521,36 +479,6 @@ pub mod table_definition_client { ); self.inner.unary(req, path, codec).await } - /// Adds columns using the money-aware definition contract. - pub async fn add_money_table_columns( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - 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/AddMoneyTableColumns", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "komp_ac.table_definition.TableDefinition", - "AddMoneyTableColumns", - ), - ); - self.inner.unary(req, path, codec).await - } /// Lists all profiles (schemas) and their tables with declared dependencies. /// This provides a tree-like overview of table relationships. pub async fn get_profile_tree( @@ -758,14 +686,6 @@ pub mod table_definition_server { tonic::Response, tonic::Status, >; - /// Creates a table using the money-aware definition contract. - async fn post_money_table_definition( - &self, - request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; /// Appends new user-defined columns to an existing table. /// Existing columns, links, and table logic are never changed by this call. async fn add_table_columns( @@ -775,14 +695,6 @@ pub mod table_definition_server { tonic::Response, tonic::Status, >; - /// Adds columns using the money-aware definition contract. - async fn add_money_table_columns( - &self, - request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; /// Lists all profiles (schemas) and their tables with declared dependencies. /// This provides a tree-like overview of table relationships. async fn get_profile_tree( @@ -963,57 +875,6 @@ pub mod table_definition_server { }; Box::pin(fut) } - "/komp_ac.table_definition.TableDefinition/PostMoneyTableDefinition" => { - #[allow(non_camel_case_types)] - struct PostMoneyTableDefinitionSvc(pub Arc); - impl< - T: TableDefinition, - > tonic::server::UnaryService - for PostMoneyTableDefinitionSvc { - type Response = super::TableDefinitionResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request< - super::PostMoneyTableDefinitionRequest, - >, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::post_money_table_definition( - &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 = PostMoneyTableDefinitionSvc(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/AddTableColumns" => { #[allow(non_camel_case_types)] struct AddTableColumnsSvc(pub Arc); @@ -1060,55 +921,6 @@ pub mod table_definition_server { }; Box::pin(fut) } - "/komp_ac.table_definition.TableDefinition/AddMoneyTableColumns" => { - #[allow(non_camel_case_types)] - struct AddMoneyTableColumnsSvc(pub Arc); - impl< - T: TableDefinition, - > tonic::server::UnaryService - for AddMoneyTableColumnsSvc { - type Response = super::TableDefinitionResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::add_money_table_columns( - &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 = AddMoneyTableColumnsSvc(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/GetProfileTree" => { #[allow(non_camel_case_types)] struct GetProfileTreeSvc(pub Arc); diff --git a/server b/server index de3235a..591c4b0 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit de3235a13c2966c2c4ffab356d7d9a3aaa5ce05a +Subproject commit 591c4b087569f23977772071ea36f73acb752d73