typst files stored in the db from now on2
This commit is contained in:
@@ -158,8 +158,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||
)
|
||||
.field_attribute(
|
||||
".komp_ac.table_definition.ColumnDefinition.boolean_ledger_operator",
|
||||
"#[serde(default)]",
|
||||
".komp_ac.table_definition.ColumnDefinition.boolean_ledger",
|
||||
"#[serde(default, alias = \"boolean_ledger_operator\")]",
|
||||
)
|
||||
.type_attribute(
|
||||
".komp_ac.table_definition.PostTableDefinitionRequest",
|
||||
|
||||
@@ -7,6 +7,7 @@ service DocumentDataService {
|
||||
rpc GetDocuments(GetDocumentsRequest) returns (GetDocumentsResponse);
|
||||
rpc GetDocument(GetDocumentRequest) returns (GetDocumentResponse);
|
||||
rpc GetDocumentVersion(GetDocumentVersionRequest) returns (GetDocumentVersionResponse);
|
||||
rpc GetTypstTemplateVersion(GetTypstTemplateVersionRequest) returns (GetTypstTemplateVersionResponse);
|
||||
}
|
||||
|
||||
message SourceRecord {
|
||||
@@ -17,28 +18,24 @@ message SourceRecord {
|
||||
}
|
||||
|
||||
message SaveDocumentRequest {
|
||||
optional int64 schema_id = 1;
|
||||
repeated SourceRecord source_records = 2;
|
||||
optional string template_name = 3;
|
||||
optional string template_kind = 4;
|
||||
optional string template_path = 5;
|
||||
string data_json = 6;
|
||||
repeated SourceRecord source_records = 1;
|
||||
string template_name = 2;
|
||||
string typst_source = 3;
|
||||
string typst_compiler_version = 4;
|
||||
string data_json = 5;
|
||||
}
|
||||
|
||||
message SaveDocumentResponse {
|
||||
int64 document_id = 1;
|
||||
int64 snapshot_id = 2;
|
||||
int32 version_number = 3;
|
||||
int64 template_version_id = 4;
|
||||
int32 template_version = 5;
|
||||
}
|
||||
|
||||
message UpdateDocumentRequest {
|
||||
int64 document_id = 1;
|
||||
optional int64 schema_id = 2;
|
||||
repeated SourceRecord source_records = 3;
|
||||
optional string template_name = 4;
|
||||
optional string template_kind = 5;
|
||||
optional string template_path = 6;
|
||||
string data_json = 7;
|
||||
string data_json = 2;
|
||||
}
|
||||
|
||||
message UpdateDocumentResponse {
|
||||
@@ -56,16 +53,15 @@ message GetDocumentsRequest {
|
||||
message Document {
|
||||
int64 snapshot_id = 1;
|
||||
int64 document_id = 2;
|
||||
optional int64 schema_id = 3;
|
||||
int64 schema_id = 3;
|
||||
repeated SourceRecord source_records = 4;
|
||||
optional string template_name = 5;
|
||||
optional string template_kind = 6;
|
||||
optional string template_path = 7;
|
||||
string data_json = 8;
|
||||
string change_kind = 9;
|
||||
int32 version_number = 10;
|
||||
string created_at = 11;
|
||||
string updated_at = 12;
|
||||
string data_json = 5;
|
||||
string change_kind = 6;
|
||||
int32 version_number = 7;
|
||||
string created_at = 8;
|
||||
string updated_at = 9;
|
||||
int64 template_version_id = 10;
|
||||
string data_sha256 = 11;
|
||||
}
|
||||
|
||||
message GetDocumentsResponse {
|
||||
@@ -88,3 +84,23 @@ message GetDocumentVersionRequest {
|
||||
message GetDocumentVersionResponse {
|
||||
optional Document document = 1;
|
||||
}
|
||||
|
||||
message GetTypstTemplateVersionRequest {
|
||||
int64 template_version_id = 1;
|
||||
int64 document_id = 2;
|
||||
}
|
||||
|
||||
message TypstTemplateVersion {
|
||||
int64 id = 1;
|
||||
int64 schema_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;
|
||||
}
|
||||
|
||||
message GetTypstTemplateVersionResponse {
|
||||
optional TypstTemplateVersion template_version = 1;
|
||||
}
|
||||
|
||||
@@ -291,8 +291,8 @@ message ColumnDefinition {
|
||||
// MONEY rounding applied before a value is stored.
|
||||
MoneyRounding rounding = 3;
|
||||
|
||||
// When true, this numeric or Boolean column is server-owned and projected
|
||||
// from ledger contributions.
|
||||
// When true, this numeric column is server-owned and projected
|
||||
// from quantity-ledger contributions.
|
||||
bool quantity_ledger = 4;
|
||||
|
||||
// Canonical uppercase ISO-4217 currency code. Required for MONEY and forbidden
|
||||
@@ -302,9 +302,9 @@ 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
|
||||
// Enables a Boolean ledger on Boolean columns. ANY means
|
||||
// one true contribution wins; ALL means one false contribution wins.
|
||||
BooleanLedgerOperator boolean_ledger_operator = 7;
|
||||
BooleanLedgerOperator boolean_ledger = 7;
|
||||
}
|
||||
|
||||
enum BooleanLedgerOperator {
|
||||
@@ -595,6 +595,8 @@ message ListColumnTypesResponse {
|
||||
|
||||
// Whether ColumnDefinition.quantity_ledger may be set on this type.
|
||||
bool allows_quantity_ledger = 8;
|
||||
// Whether ColumnDefinition.boolean_ledger may be set on this type.
|
||||
bool allows_boolean_ledger = 11;
|
||||
|
||||
// Optional name grouping several types a client offers behind one choice —
|
||||
// "temporal" for the date and time types, "gtin" for the GTIN lengths.
|
||||
|
||||
Binary file not shown.
@@ -12,17 +12,15 @@ pub struct SourceRecord {
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct SaveDocumentRequest {
|
||||
#[prost(int64, optional, tag = "1")]
|
||||
pub schema_id: ::core::option::Option<i64>,
|
||||
#[prost(message, repeated, tag = "2")]
|
||||
#[prost(message, repeated, tag = "1")]
|
||||
pub source_records: ::prost::alloc::vec::Vec<SourceRecord>,
|
||||
#[prost(string, optional, tag = "3")]
|
||||
pub template_name: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(string, optional, tag = "4")]
|
||||
pub template_kind: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(string, optional, tag = "5")]
|
||||
pub template_path: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(string, tag = "6")]
|
||||
#[prost(string, tag = "2")]
|
||||
pub template_name: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "3")]
|
||||
pub typst_source: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "4")]
|
||||
pub typst_compiler_version: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "5")]
|
||||
pub data_json: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
@@ -33,22 +31,16 @@ pub struct SaveDocumentResponse {
|
||||
pub snapshot_id: i64,
|
||||
#[prost(int32, tag = "3")]
|
||||
pub version_number: i32,
|
||||
#[prost(int64, tag = "4")]
|
||||
pub template_version_id: i64,
|
||||
#[prost(int32, tag = "5")]
|
||||
pub template_version: i32,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct UpdateDocumentRequest {
|
||||
#[prost(int64, tag = "1")]
|
||||
pub document_id: i64,
|
||||
#[prost(int64, optional, tag = "2")]
|
||||
pub schema_id: ::core::option::Option<i64>,
|
||||
#[prost(message, repeated, tag = "3")]
|
||||
pub source_records: ::prost::alloc::vec::Vec<SourceRecord>,
|
||||
#[prost(string, optional, tag = "4")]
|
||||
pub template_name: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(string, optional, tag = "5")]
|
||||
pub template_kind: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(string, optional, tag = "6")]
|
||||
pub template_path: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(string, tag = "7")]
|
||||
#[prost(string, tag = "2")]
|
||||
pub data_json: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
@@ -75,26 +67,24 @@ pub struct Document {
|
||||
pub snapshot_id: i64,
|
||||
#[prost(int64, tag = "2")]
|
||||
pub document_id: i64,
|
||||
#[prost(int64, optional, tag = "3")]
|
||||
pub schema_id: ::core::option::Option<i64>,
|
||||
#[prost(int64, tag = "3")]
|
||||
pub schema_id: i64,
|
||||
#[prost(message, repeated, tag = "4")]
|
||||
pub source_records: ::prost::alloc::vec::Vec<SourceRecord>,
|
||||
#[prost(string, optional, tag = "5")]
|
||||
pub template_name: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(string, optional, tag = "6")]
|
||||
pub template_kind: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(string, optional, tag = "7")]
|
||||
pub template_path: ::core::option::Option<::prost::alloc::string::String>,
|
||||
#[prost(string, tag = "8")]
|
||||
#[prost(string, tag = "5")]
|
||||
pub data_json: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "9")]
|
||||
#[prost(string, tag = "6")]
|
||||
pub change_kind: ::prost::alloc::string::String,
|
||||
#[prost(int32, tag = "10")]
|
||||
#[prost(int32, tag = "7")]
|
||||
pub version_number: i32,
|
||||
#[prost(string, tag = "11")]
|
||||
#[prost(string, tag = "8")]
|
||||
pub created_at: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "12")]
|
||||
#[prost(string, tag = "9")]
|
||||
pub updated_at: ::prost::alloc::string::String,
|
||||
#[prost(int64, tag = "10")]
|
||||
pub template_version_id: i64,
|
||||
#[prost(string, tag = "11")]
|
||||
pub data_sha256: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct GetDocumentsResponse {
|
||||
@@ -123,6 +113,37 @@ pub struct GetDocumentVersionResponse {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub document: ::core::option::Option<Document>,
|
||||
}
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct GetTypstTemplateVersionRequest {
|
||||
#[prost(int64, tag = "1")]
|
||||
pub template_version_id: i64,
|
||||
#[prost(int64, tag = "2")]
|
||||
pub document_id: i64,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct TypstTemplateVersion {
|
||||
#[prost(int64, tag = "1")]
|
||||
pub id: i64,
|
||||
#[prost(int64, tag = "2")]
|
||||
pub schema_id: i64,
|
||||
#[prost(string, tag = "3")]
|
||||
pub template_name: ::prost::alloc::string::String,
|
||||
#[prost(int32, tag = "4")]
|
||||
pub version: i32,
|
||||
#[prost(string, tag = "5")]
|
||||
pub source_code: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "6")]
|
||||
pub source_sha256: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "7")]
|
||||
pub typst_compiler_version: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "8")]
|
||||
pub created_at: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct GetTypstTemplateVersionResponse {
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub template_version: ::core::option::Option<TypstTemplateVersion>,
|
||||
}
|
||||
/// Generated client implementations.
|
||||
pub mod document_data_service_client {
|
||||
#![allow(
|
||||
@@ -359,6 +380,35 @@ pub mod document_data_service_client {
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
pub async fn get_typst_template_version(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::GetTypstTemplateVersionRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::GetTypstTemplateVersionResponse>,
|
||||
tonic::Status,
|
||||
> {
|
||||
self.inner
|
||||
.ready()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
tonic::Status::unknown(
|
||||
format!("Service was not ready: {}", e.into()),
|
||||
)
|
||||
})?;
|
||||
let codec = tonic_prost::ProstCodec::default();
|
||||
let path = http::uri::PathAndQuery::from_static(
|
||||
"/komp_ac.document_data.DocumentDataService/GetTypstTemplateVersion",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new(
|
||||
"komp_ac.document_data.DocumentDataService",
|
||||
"GetTypstTemplateVersion",
|
||||
),
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Generated server implementations.
|
||||
@@ -409,6 +459,13 @@ pub mod document_data_service_server {
|
||||
tonic::Response<super::GetDocumentVersionResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
async fn get_typst_template_version(
|
||||
&self,
|
||||
request: tonic::Request<super::GetTypstTemplateVersionRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::GetTypstTemplateVersionResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
}
|
||||
#[derive(Debug)]
|
||||
pub struct DocumentDataServiceServer<T> {
|
||||
@@ -719,6 +776,59 @@ pub mod document_data_service_server {
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/komp_ac.document_data.DocumentDataService/GetTypstTemplateVersion" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct GetTypstTemplateVersionSvc<T: DocumentDataService>(
|
||||
pub Arc<T>,
|
||||
);
|
||||
impl<
|
||||
T: DocumentDataService,
|
||||
> tonic::server::UnaryService<super::GetTypstTemplateVersionRequest>
|
||||
for GetTypstTemplateVersionSvc<T> {
|
||||
type Response = super::GetTypstTemplateVersionResponse;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<
|
||||
super::GetTypstTemplateVersionRequest,
|
||||
>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as DocumentDataService>::get_typst_template_version(
|
||||
&inner,
|
||||
request,
|
||||
)
|
||||
.await
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
}
|
||||
let accept_compression_encodings = self.accept_compression_encodings;
|
||||
let send_compression_encodings = self.send_compression_encodings;
|
||||
let max_decoding_message_size = self.max_decoding_message_size;
|
||||
let max_encoding_message_size = self.max_encoding_message_size;
|
||||
let inner = self.inner.clone();
|
||||
let fut = async move {
|
||||
let method = GetTypstTemplateVersionSvc(inner);
|
||||
let codec = tonic_prost::ProstCodec::default();
|
||||
let mut grpc = tonic::server::Grpc::new(codec)
|
||||
.apply_compression_config(
|
||||
accept_compression_encodings,
|
||||
send_compression_encodings,
|
||||
)
|
||||
.apply_max_message_size_config(
|
||||
max_decoding_message_size,
|
||||
max_encoding_message_size,
|
||||
);
|
||||
let res = grpc.unary(method, req).await;
|
||||
Ok(res)
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
_ => {
|
||||
Box::pin(async move {
|
||||
let mut response = http::Response::new(
|
||||
|
||||
@@ -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 or Boolean column is server-owned and projected
|
||||
/// from ledger contributions.
|
||||
/// When true, this numeric column is server-owned and projected
|
||||
/// from quantity-ledger contributions.
|
||||
#[prost(bool, tag = "4")]
|
||||
pub quantity_ledger: bool,
|
||||
/// Canonical uppercase ISO-4217 currency code. Required for MONEY and forbidden
|
||||
@@ -266,11 +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
|
||||
/// Enables a Boolean ledger on Boolean columns. ANY means
|
||||
/// one true contribution wins; ALL means one false contribution wins.
|
||||
#[prost(enumeration = "BooleanLedgerOperator", tag = "7")]
|
||||
#[serde(default)]
|
||||
pub boolean_ledger_operator: i32,
|
||||
#[serde(default, alias = "boolean_ledger_operator")]
|
||||
pub boolean_ledger: i32,
|
||||
}
|
||||
/// Response after table creation (success + DDL preview).
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
@@ -620,6 +620,9 @@ pub mod list_column_types_response {
|
||||
/// Whether ColumnDefinition.quantity_ledger may be set on this type.
|
||||
#[prost(bool, tag = "8")]
|
||||
pub allows_quantity_ledger: bool,
|
||||
/// Whether ColumnDefinition.boolean_ledger may be set on this type.
|
||||
#[prost(bool, tag = "11")]
|
||||
pub allows_boolean_ledger: bool,
|
||||
/// Optional name grouping several types a client offers behind one choice —
|
||||
/// "temporal" for the date and time types, "gtin" for the GTIN lengths.
|
||||
/// Empty when the type stands on its own.
|
||||
|
||||
Reference in New Issue
Block a user