templates are per profile from the global table

This commit is contained in:
Filipriec
2026-08-30 01:14:55 +02:00
parent d4781698fd
commit 80d61760a2
11 changed files with 397 additions and 3831 deletions

View File

@@ -2,6 +2,9 @@ syntax = "proto3";
package komp_ac.document_data;
service DocumentDataService {
rpc RegisterTypstTemplate(RegisterTypstTemplateRequest) returns (RegisterTypstTemplateResponse);
rpc ListTypstTemplates(ListTypstTemplatesRequest) returns (ListTypstTemplatesResponse);
rpc ListEnabledTypstTemplates(ListEnabledTypstTemplatesRequest) returns (ListTypstTemplatesResponse);
rpc SaveDocument(SaveDocumentRequest) returns (SaveDocumentResponse);
rpc UpdateDocument(UpdateDocumentRequest) returns (UpdateDocumentResponse);
rpc GetDocuments(GetDocumentsRequest) returns (GetDocumentsResponse);
@@ -20,9 +23,31 @@ message SourceRecord {
message SaveDocumentRequest {
repeated SourceRecord source_records = 1;
string template_name = 2;
string data_json = 3;
}
message RegisterTypstTemplateRequest {
string template_name = 1;
string input_table_name = 2;
string typst_source = 3;
string typst_compiler_version = 4;
string data_json = 5;
}
message RegisterTypstTemplateResponse {
TypstTemplateVersion template_version = 1;
}
message ListTypstTemplatesRequest {
string search = 1;
uint32 limit = 2;
}
message ListTypstTemplatesResponse {
repeated TypstTemplateVersion templates = 1;
}
message ListEnabledTypstTemplatesRequest {
string profile_name = 1;
}
message SaveDocumentResponse {
@@ -92,13 +117,14 @@ message GetTypstTemplateVersionRequest {
message TypstTemplateVersion {
int64 id = 1;
int64 schema_id = 2;
int64 template_id = 2;
string template_name = 3;
int32 version = 4;
string source_code = 5;
string source_sha256 = 6;
string typst_compiler_version = 7;
string created_at = 8;
string input_table_name = 9;
}
message GetTypstTemplateVersionResponse {

View File

@@ -157,23 +157,12 @@ message GeneratedColumnAlias {
}
// Defines the input for explicitly creating tables backed by one invoice
// template. typst_source must contain exactly one field declaration:
//
// #let komp_ac_fields = (
// "sidlo.nazov",
// "people[].name",
// "people[].requested_quantity",
// )
//
// A path matching an existing profile table and column becomes a reference to
// that table. Otherwise its final segment becomes a local TEXT column for an
// administrator to refine later. Every [] creates a child table with a required
// FK to its immediate generated parent.
// Enables a stored global Typst template for one profile and immediately
// creates the input-table family declared by that template.
message CreateInvoiceTemplateTableRequest {
string profile_name = 1;
string table_name = 2;
string typst_source = 3;
repeated string row_display_columns = 5;
string template_name = 2;
repeated string row_display_columns = 3;
}
// One physical dynamic table created for an invoice template scope. The root