diff --git a/common/build.rs b/common/build.rs index 4d05e10a..4b80a955 100644 --- a/common/build.rs +++ b/common/build.rs @@ -157,6 +157,10 @@ fn main() -> Result<(), Box> { ".komp_ac.table_definition.ColumnDefinition", "#[derive(serde::Serialize, serde::Deserialize)]", ) + .field_attribute( + ".komp_ac.table_definition.ColumnDefinition.boolean_ledger_operator", + "#[serde(default)]", + ) .type_attribute( ".komp_ac.table_definition.PostTableDefinitionRequest", "#[derive(serde::Serialize, serde::Deserialize)]", diff --git a/common/proto/table_definition.proto b/common/proto/table_definition.proto index 8dc9ecfe..3fbdfa63 100644 --- a/common/proto/table_definition.proto +++ b/common/proto/table_definition.proto @@ -291,8 +291,8 @@ message ColumnDefinition { // MONEY rounding applied before a value is stored. MoneyRounding rounding = 3; - // When true, this numeric column is server-owned and projected from the - // profile quantity ledger. + // When true, this numeric or Boolean column is server-owned and projected + // from ledger contributions. bool quantity_ledger = 4; // Canonical uppercase ISO-4217 currency code. Required for MONEY and forbidden @@ -301,6 +301,16 @@ message ColumnDefinition { // When true, the server rejects omitted or explicitly null values. bool required = 6; + + // Required for Boolean ledger columns and forbidden otherwise. ANY means + // one true contribution wins; ALL means one false contribution wins. + BooleanLedgerOperator boolean_ledger_operator = 7; +} + +enum BooleanLedgerOperator { + BOOLEAN_LEDGER_OPERATOR_UNSPECIFIED = 0; + BOOLEAN_LEDGER_OPERATOR_ANY = 1; + BOOLEAN_LEDGER_OPERATOR_ALL = 2; } // Response after table creation (success + DDL preview). diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index 29713fe9..371c8cbe 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 3b8cb7f6..ac0ab261 100644 --- a/common/src/proto/komp_ac.table_definition.rs +++ b/common/src/proto/komp_ac.table_definition.rs @@ -255,8 +255,8 @@ pub struct ColumnDefinition { /// MONEY rounding applied before a value is stored. #[prost(enumeration = "MoneyRounding", tag = "3")] pub rounding: i32, - /// When true, this numeric column is server-owned and projected from the - /// profile quantity ledger. + /// When true, this numeric or Boolean column is server-owned and projected + /// from ledger contributions. #[prost(bool, tag = "4")] pub quantity_ledger: bool, /// Canonical uppercase ISO-4217 currency code. Required for MONEY and forbidden @@ -266,6 +266,11 @@ pub struct ColumnDefinition { /// When true, the server rejects omitted or explicitly null values. #[prost(bool, tag = "6")] pub required: bool, + /// Required for Boolean ledger columns and forbidden otherwise. ANY means + /// one true contribution wins; ALL means one false contribution wins. + #[prost(enumeration = "BooleanLedgerOperator", tag = "7")] + #[serde(default)] + pub boolean_ledger_operator: i32, } /// Response after table creation (success + DDL preview). #[derive(serde::Serialize, serde::Deserialize)] @@ -677,6 +682,35 @@ impl MoneyRounding { } } } +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum BooleanLedgerOperator { + Unspecified = 0, + Any = 1, + All = 2, +} +impl BooleanLedgerOperator { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "BOOLEAN_LEDGER_OPERATOR_UNSPECIFIED", + Self::Any => "BOOLEAN_LEDGER_OPERATOR_ANY", + Self::All => "BOOLEAN_LEDGER_OPERATOR_ALL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "BOOLEAN_LEDGER_OPERATOR_UNSPECIFIED" => Some(Self::Unspecified), + "BOOLEAN_LEDGER_OPERATOR_ANY" => Some(Self::Any), + "BOOLEAN_LEDGER_OPERATOR_ALL" => Some(Self::All), + _ => None, + } + } +} /// How a column type is spelled in ColumnDefinition.field_type. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] diff --git a/server b/server index 3b4f7ee7..554e98ec 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit 3b4f7ee71ec316ead162c698f934b15959fcce27 +Subproject commit 554e98ec117ea09f9a856dcbc3c1c86b6768fc30