diff --git a/client b/client index 71b5cff..c7ba851 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit 71b5cff16d9a51543b964eee23b2d311584b6916 +Subproject commit c7ba851c7313955e9b84bae4e766696da878632d diff --git a/common/proto/table_definition.proto b/common/proto/table_definition.proto index 9f6adbc..5ab5ae3 100644 --- a/common/proto/table_definition.proto +++ b/common/proto/table_definition.proto @@ -197,7 +197,9 @@ message ColumnDefinition { // MONEY rounding applied before a value is stored. MoneyRounding rounding = 4; - reserved 5; + // When true, this numeric column is server-owned and projected from the + // profile quantity ledger. + bool quantity_ledger = 5; } // Response after table creation (success + DDL preview). diff --git a/common/proto/table_structure.proto b/common/proto/table_structure.proto index e533265..d840f2f 100644 --- a/common/proto/table_structure.proto +++ b/common/proto/table_structure.proto @@ -73,9 +73,8 @@ message TableColumn { // Typically true for the "id" column created by the system. bool is_primary_key = 4; - // True for a user-defined column whose logic should be recomputed whenever - // one of its dependencies changes. False for system and foreign-key columns. - reserved 5; + // True when this column is projected from the profile quantity ledger. + bool quantity_ledger = 5; // True when the server created this as a companion of another logical column. bool generated = 6; diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index 031a899..7cc2fdb 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 4c8d4d0..0a98666 100644 --- a/common/src/proto/komp_ac.table_definition.rs +++ b/common/src/proto/komp_ac.table_definition.rs @@ -166,6 +166,10 @@ pub struct ColumnDefinition { /// MONEY rounding applied before a value is stored. #[prost(enumeration = "MoneyRounding", tag = "4")] pub rounding: i32, + /// When true, this numeric column is server-owned and projected from the + /// profile quantity ledger. + #[prost(bool, tag = "5")] + pub quantity_ledger: bool, } /// Response after table creation (success + DDL preview). #[derive(serde::Serialize, serde::Deserialize)] diff --git a/common/src/proto/komp_ac.table_structure.rs b/common/src/proto/komp_ac.table_structure.rs index 5a1a591..6f66e7d 100644 --- a/common/src/proto/komp_ac.table_structure.rs +++ b/common/src/proto/komp_ac.table_structure.rs @@ -55,6 +55,9 @@ pub struct TableColumn { /// Typically true for the "id" column created by the system. #[prost(bool, tag = "4")] pub is_primary_key: bool, + /// True when this column is projected from the profile quantity ledger. + #[prost(bool, tag = "5")] + pub quantity_ledger: bool, /// True when the server created this as a companion of another logical column. #[prost(bool, tag = "6")] pub generated: bool, diff --git a/graphs/src/pages/add_table/state.rs b/graphs/src/pages/add_table/state.rs index 110528d..48c95c8 100644 --- a/graphs/src/pages/add_table/state.rs +++ b/graphs/src/pages/add_table/state.rs @@ -74,6 +74,7 @@ impl CreateTableForm { name: name.to_string(), field_type: field_type.to_string(), rounding: rounding.into(), + quantity_ledger: flags.contains(&"quantity-ledger"), }); } if columns.is_empty() { @@ -143,7 +144,7 @@ mod tests { let request = CreateTableForm { profile_name: "accounting".into(), table_name: "invoice".into(), - columns: "number: text:indexed\namount: money:half-up".into(), + columns: "number: text:indexed\namount: money:half-up,quantity-ledger".into(), required_links: "customer".into(), base_currency: "eur".into(), row_display_columns: "number, amount".into(), @@ -157,5 +158,6 @@ mod tests { assert!(request.links[0].required); assert_eq!(request.base_currency, "EUR"); assert_eq!(request.row_display_columns, vec!["number", "amount"]); + assert!(request.columns[1].quantity_ledger); } } diff --git a/graphs/src/pages/add_table/ui.rs b/graphs/src/pages/add_table/ui.rs index ae6f3f9..86aefc8 100644 --- a/graphs/src/pages/add_table/ui.rs +++ b/graphs/src/pages/add_table/ui.rs @@ -21,7 +21,7 @@ pub(crate) fn render_page(page: &AddTablePageState) -> String { .map(render_submission_error) .unwrap_or_default(); format!( - "Add table
Komp Accounting
← Admin panel

Table definition

Add table

Create a table through the existing gRPC table-definition service.

{error}
Cancel
", + "Add table
Komp Accounting
← Admin panel

Table definition

Add table

Create a table through the existing gRPC table-definition service.

{error}
Cancel
", crate::escape_html(&page.form.table_name), crate::escape_html(&page.form.columns), crate::escape_html(&page.form.indexed_columns), diff --git a/graphs/src/pages/admin/admin/loader.rs b/graphs/src/pages/admin/admin/loader.rs index 95ebfb8..440e1b9 100644 --- a/graphs/src/pages/admin/admin/loader.rs +++ b/graphs/src/pages/admin/admin/loader.rs @@ -113,6 +113,7 @@ pub(crate) async fn load_admin_page( data_type: column.data_type.clone(), nullable: column.is_nullable, primary_key: column.is_primary_key, + quantity_ledger: column.quantity_ledger, }) .collect() } diff --git a/graphs/src/pages/admin/admin/state.rs b/graphs/src/pages/admin/admin/state.rs index 668b702..12c2918 100644 --- a/graphs/src/pages/admin/admin/state.rs +++ b/graphs/src/pages/admin/admin/state.rs @@ -35,6 +35,7 @@ pub(crate) struct ColumnView { pub data_type: String, pub nullable: bool, pub primary_key: bool, + pub quantity_ledger: bool, } #[derive(Debug)] diff --git a/graphs/src/pages/admin/admin/ui.rs b/graphs/src/pages/admin/admin/ui.rs index fe7feec..8ca68bd 100644 --- a/graphs/src/pages/admin/admin/ui.rs +++ b/graphs/src/pages/admin/admin/ui.rs @@ -95,6 +95,9 @@ fn render_columns(page: &AdminPageState) -> String { } else { flags.push("required"); } + if column.quantity_ledger { + flags.push("quantity ledger"); + } format!( "
{}{}{}
", crate::escape_html(&column.name), diff --git a/server b/server index b44238e..d4343fe 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit b44238ec3b3cca9e5dcf2367767fdba64db41f82 +Subproject commit d4343fe48bcec8c87ef77e181a41a02f9f599d5b