aliasing for accounting, where accounting real column names are the same as others, which is 0..n as opposed to previously real names and hardcoded search via those. Now we are using a look up table for the numbers mapping to look em up

This commit is contained in:
Priec
2026-08-13 13:41:07 +02:00
parent 774c9a3ce0
commit 27d3e9af34
11 changed files with 444 additions and 10 deletions

Binary file not shown.

View File

@@ -43,6 +43,34 @@ pub struct PostTableDefinitionRequest {
/// visible from every profile. profile_name and accounting_currency are ignored.
#[prost(bool, tag = "9")]
pub global: bool,
/// Names for the columns a definition row generates, in place of the ones the
/// backend would give them. See GeneratedColumnAlias.
#[prost(message, repeated, tag = "10")]
pub generated_aliases: ::prost::alloc::vec::Vec<GeneratedColumnAlias>,
}
/// Renames one column a definition row generates, at the moment it is created.
///
/// A generated column cannot be named in the column list -- the definition row
/// is required to be named after its own type, and what it expands into is the
/// backend's to decide. The name is only ever a display name over a physical
/// column, though, so it is free to be anything: this is where that choice is
/// made, instead of a RenameColumnAlias call afterwards.
///
/// The ACCOUNTING_TRANSFER connectors are the exception. They are refused here
/// exactly as RenameColumnAlias refuses them.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GeneratedColumnAlias {
/// The name the backend would otherwise give the column: one of ACCOUNTING's
/// "name", "tax_point_date", "debit", "credit" or "account", or a companion
/// such as "work_phone_extension". Must name a column the request really
/// generates -- an alias for anything else is rejected rather than ignored,
/// so a typo cannot pass silently.
#[prost(string, tag = "1")]
pub generated_name: ::prost::alloc::string::String,
/// What the column should be called instead. Same rules as any column name.
#[prost(string, tag = "2")]
pub alias: ::prost::alloc::string::String,
}
/// Defines the input for explicitly creating tables backed by one invoice
/// template. typst_source must contain exactly one field declaration:
@@ -110,6 +138,10 @@ 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>,
/// Names for the columns the appended definition rows generate, exactly as on
/// PostTableDefinitionRequest.
#[prost(message, repeated, tag = "5")]
pub generated_aliases: ::prost::alloc::vec::Vec<GeneratedColumnAlias>,
}
/// Describes one user-defined column for a table.
#[derive(serde::Serialize, serde::Deserialize)]