map invoice with multioption select

This commit is contained in:
Priec
2026-07-21 22:55:25 +02:00
parent 2dc719e55b
commit 7c022daab5
6 changed files with 203 additions and 2 deletions

View File

@@ -14,6 +14,11 @@ service TableDefinition {
// Also inserts metadata and default validation rules. Entirely transactional.
rpc PostTableDefinition(PostTableDefinitionRequest) returns (TableDefinitionResponse);
// Creates a regular user-table bundle from the restricted komp_ac_fields
// contract embedded in a Typst invoice template. This is invoked explicitly
// by the user; templates do not provision tables merely by existing.
rpc CreateInvoiceTemplateTable(CreateInvoiceTemplateTableRequest) returns (CreateInvoiceTemplateTableResponse);
// 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);
@@ -86,6 +91,44 @@ message PostTableDefinitionRequest {
string row_display_column = 7;
}
// Defines the input for explicitly creating a table backed by one invoice
// template. typst_source must contain exactly one declaration of the form:
//
// #let komp_ac_fields = (
// "invoice.number": (source: "local", field_type: "TEXT", write: "user"),
// "items[].product": (source: "reference", table: "stock", required: true),
// "items[].quantity": (source: "local", field_type: "DECIMAL(12,3)", write: "user"),
// "items[].total": (source: "local", field_type: "MONEY", write: "script"),
// )
//
// Root fields create columns and references on table_name. Every [] collection
// creates a child table with a required FK to its immediate parent; fields in
// that collection create columns and references on the child table. Multiple
// template paths in one scope may reuse the same reference.
message CreateInvoiceTemplateTableRequest {
string profile_name = 1;
string table_name = 2;
string typst_source = 3;
string base_currency = 4;
string row_display_column = 5;
}
// One physical dynamic table created for an invoice template scope. The root
// has an empty collection_path and parent_table_name. Each [] scope names its
// collection and the generated table that owns those repeated rows.
message GeneratedInvoiceTemplateTable {
string table_name = 1;
string collection_path = 2;
string parent_table_name = 3;
string sql = 4;
}
// Reports the complete table bundle created from one invoice template.
message CreateInvoiceTemplateTableResponse {
bool success = 1;
repeated GeneratedInvoiceTemplateTable tables = 2;
}
// Defines append-only column additions for an existing table.
message AddTableColumnsRequest {
// Existing profile/schema name.