accounting kernel3
This commit is contained in:
@@ -10,6 +10,13 @@ service Accounting {
|
|||||||
// Return journal lines and credits-minus-debits informational balance.
|
// Return journal lines and credits-minus-debits informational balance.
|
||||||
rpc GetJournal(GetJournalRequest) returns (Journal);
|
rpc GetJournal(GetJournalRequest) returns (Journal);
|
||||||
|
|
||||||
|
// Return the profile-wide count of balanced and unbalanced journals.
|
||||||
|
rpc GetAccountingStatus(GetAccountingStatusRequest) returns (AccountingStatus);
|
||||||
|
|
||||||
|
// Return an oldest-first, paginated queue of unbalanced journals.
|
||||||
|
rpc ListUnbalancedJournals(ListUnbalancedJournalsRequest)
|
||||||
|
returns (ListUnbalancedJournalsResponse);
|
||||||
|
|
||||||
// Append one manual debit or credit line to an existing journal.
|
// Append one manual debit or credit line to an existing journal.
|
||||||
rpc AddJournalLine(AddJournalLineRequest) returns (Journal);
|
rpc AddJournalLine(AddJournalLineRequest) returns (Journal);
|
||||||
|
|
||||||
@@ -39,6 +46,55 @@ message GetJournalRequest {
|
|||||||
bool include_deleted = 3;
|
bool include_deleted = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message GetAccountingStatusRequest {
|
||||||
|
string profile_name = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AccountingStatus {
|
||||||
|
bool all_journals_balanced = 1;
|
||||||
|
int64 journal_count = 2;
|
||||||
|
int64 balanced_journal_count = 3;
|
||||||
|
int64 unbalanced_journal_count = 4;
|
||||||
|
string calculated_at = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListUnbalancedJournalsRequest {
|
||||||
|
string profile_name = 1;
|
||||||
|
|
||||||
|
// Zero uses 50. The maximum is 500.
|
||||||
|
int32 page_size = 2;
|
||||||
|
|
||||||
|
// Opaque cursor returned by the previous response. Empty starts at the
|
||||||
|
// oldest unbalanced journal.
|
||||||
|
string page_token = 3;
|
||||||
|
|
||||||
|
// Optional ISO 4217 currency filter. Empty includes every currency.
|
||||||
|
string currency = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UnbalancedJournalSummary {
|
||||||
|
int64 journal_id = 1;
|
||||||
|
string description = 2;
|
||||||
|
string currency = 3;
|
||||||
|
string total_debit = 4;
|
||||||
|
string total_credit = 5;
|
||||||
|
|
||||||
|
// Signed credits-minus-debits difference.
|
||||||
|
string balance = 6;
|
||||||
|
|
||||||
|
// Side and positive amount needed to make the journal balance zero.
|
||||||
|
JournalSide missing_side = 7;
|
||||||
|
string missing_amount = 8;
|
||||||
|
int64 active_line_count = 9;
|
||||||
|
string created_at = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListUnbalancedJournalsResponse {
|
||||||
|
repeated UnbalancedJournalSummary journals = 1;
|
||||||
|
int64 total_unbalanced_count = 2;
|
||||||
|
string next_page_token = 3;
|
||||||
|
}
|
||||||
|
|
||||||
message AddJournalLineRequest {
|
message AddJournalLineRequest {
|
||||||
string profile_name = 1;
|
string profile_name = 1;
|
||||||
int64 journal_id = 2;
|
int64 journal_id = 2;
|
||||||
|
|||||||
Binary file not shown.
@@ -18,6 +18,73 @@ pub struct GetJournalRequest {
|
|||||||
pub include_deleted: bool,
|
pub include_deleted: bool,
|
||||||
}
|
}
|
||||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||||
|
pub struct GetAccountingStatusRequest {
|
||||||
|
#[prost(string, tag = "1")]
|
||||||
|
pub profile_name: ::prost::alloc::string::String,
|
||||||
|
}
|
||||||
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||||
|
pub struct AccountingStatus {
|
||||||
|
#[prost(bool, tag = "1")]
|
||||||
|
pub all_journals_balanced: bool,
|
||||||
|
#[prost(int64, tag = "2")]
|
||||||
|
pub journal_count: i64,
|
||||||
|
#[prost(int64, tag = "3")]
|
||||||
|
pub balanced_journal_count: i64,
|
||||||
|
#[prost(int64, tag = "4")]
|
||||||
|
pub unbalanced_journal_count: i64,
|
||||||
|
#[prost(string, tag = "5")]
|
||||||
|
pub calculated_at: ::prost::alloc::string::String,
|
||||||
|
}
|
||||||
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||||
|
pub struct ListUnbalancedJournalsRequest {
|
||||||
|
#[prost(string, tag = "1")]
|
||||||
|
pub profile_name: ::prost::alloc::string::String,
|
||||||
|
/// Zero uses 50. The maximum is 500.
|
||||||
|
#[prost(int32, tag = "2")]
|
||||||
|
pub page_size: i32,
|
||||||
|
/// Opaque cursor returned by the previous response. Empty starts at the
|
||||||
|
/// oldest unbalanced journal.
|
||||||
|
#[prost(string, tag = "3")]
|
||||||
|
pub page_token: ::prost::alloc::string::String,
|
||||||
|
/// Optional ISO 4217 currency filter. Empty includes every currency.
|
||||||
|
#[prost(string, tag = "4")]
|
||||||
|
pub currency: ::prost::alloc::string::String,
|
||||||
|
}
|
||||||
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||||
|
pub struct UnbalancedJournalSummary {
|
||||||
|
#[prost(int64, tag = "1")]
|
||||||
|
pub journal_id: i64,
|
||||||
|
#[prost(string, tag = "2")]
|
||||||
|
pub description: ::prost::alloc::string::String,
|
||||||
|
#[prost(string, tag = "3")]
|
||||||
|
pub currency: ::prost::alloc::string::String,
|
||||||
|
#[prost(string, tag = "4")]
|
||||||
|
pub total_debit: ::prost::alloc::string::String,
|
||||||
|
#[prost(string, tag = "5")]
|
||||||
|
pub total_credit: ::prost::alloc::string::String,
|
||||||
|
/// Signed credits-minus-debits difference.
|
||||||
|
#[prost(string, tag = "6")]
|
||||||
|
pub balance: ::prost::alloc::string::String,
|
||||||
|
/// Side and positive amount needed to make the journal balance zero.
|
||||||
|
#[prost(enumeration = "JournalSide", tag = "7")]
|
||||||
|
pub missing_side: i32,
|
||||||
|
#[prost(string, tag = "8")]
|
||||||
|
pub missing_amount: ::prost::alloc::string::String,
|
||||||
|
#[prost(int64, tag = "9")]
|
||||||
|
pub active_line_count: i64,
|
||||||
|
#[prost(string, tag = "10")]
|
||||||
|
pub created_at: ::prost::alloc::string::String,
|
||||||
|
}
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct ListUnbalancedJournalsResponse {
|
||||||
|
#[prost(message, repeated, tag = "1")]
|
||||||
|
pub journals: ::prost::alloc::vec::Vec<UnbalancedJournalSummary>,
|
||||||
|
#[prost(int64, tag = "2")]
|
||||||
|
pub total_unbalanced_count: i64,
|
||||||
|
#[prost(string, tag = "3")]
|
||||||
|
pub next_page_token: ::prost::alloc::string::String,
|
||||||
|
}
|
||||||
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||||
pub struct AddJournalLineRequest {
|
pub struct AddJournalLineRequest {
|
||||||
#[prost(string, tag = "1")]
|
#[prost(string, tag = "1")]
|
||||||
pub profile_name: ::prost::alloc::string::String,
|
pub profile_name: ::prost::alloc::string::String,
|
||||||
@@ -260,6 +327,66 @@ pub mod accounting_client {
|
|||||||
.insert(GrpcMethod::new("komp_ac.accounting.Accounting", "GetJournal"));
|
.insert(GrpcMethod::new("komp_ac.accounting.Accounting", "GetJournal"));
|
||||||
self.inner.unary(req, path, codec).await
|
self.inner.unary(req, path, codec).await
|
||||||
}
|
}
|
||||||
|
/// Return the profile-wide count of balanced and unbalanced journals.
|
||||||
|
pub async fn get_accounting_status(
|
||||||
|
&mut self,
|
||||||
|
request: impl tonic::IntoRequest<super::GetAccountingStatusRequest>,
|
||||||
|
) -> std::result::Result<
|
||||||
|
tonic::Response<super::AccountingStatus>,
|
||||||
|
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.accounting.Accounting/GetAccountingStatus",
|
||||||
|
);
|
||||||
|
let mut req = request.into_request();
|
||||||
|
req.extensions_mut()
|
||||||
|
.insert(
|
||||||
|
GrpcMethod::new(
|
||||||
|
"komp_ac.accounting.Accounting",
|
||||||
|
"GetAccountingStatus",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
self.inner.unary(req, path, codec).await
|
||||||
|
}
|
||||||
|
/// Return an oldest-first, paginated queue of unbalanced journals.
|
||||||
|
pub async fn list_unbalanced_journals(
|
||||||
|
&mut self,
|
||||||
|
request: impl tonic::IntoRequest<super::ListUnbalancedJournalsRequest>,
|
||||||
|
) -> std::result::Result<
|
||||||
|
tonic::Response<super::ListUnbalancedJournalsResponse>,
|
||||||
|
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.accounting.Accounting/ListUnbalancedJournals",
|
||||||
|
);
|
||||||
|
let mut req = request.into_request();
|
||||||
|
req.extensions_mut()
|
||||||
|
.insert(
|
||||||
|
GrpcMethod::new(
|
||||||
|
"komp_ac.accounting.Accounting",
|
||||||
|
"ListUnbalancedJournals",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
self.inner.unary(req, path, codec).await
|
||||||
|
}
|
||||||
/// Append one manual debit or credit line to an existing journal.
|
/// Append one manual debit or credit line to an existing journal.
|
||||||
pub async fn add_journal_line(
|
pub async fn add_journal_line(
|
||||||
&mut self,
|
&mut self,
|
||||||
@@ -336,6 +463,22 @@ pub mod accounting_server {
|
|||||||
&self,
|
&self,
|
||||||
request: tonic::Request<super::GetJournalRequest>,
|
request: tonic::Request<super::GetJournalRequest>,
|
||||||
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status>;
|
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status>;
|
||||||
|
/// Return the profile-wide count of balanced and unbalanced journals.
|
||||||
|
async fn get_accounting_status(
|
||||||
|
&self,
|
||||||
|
request: tonic::Request<super::GetAccountingStatusRequest>,
|
||||||
|
) -> std::result::Result<
|
||||||
|
tonic::Response<super::AccountingStatus>,
|
||||||
|
tonic::Status,
|
||||||
|
>;
|
||||||
|
/// Return an oldest-first, paginated queue of unbalanced journals.
|
||||||
|
async fn list_unbalanced_journals(
|
||||||
|
&self,
|
||||||
|
request: tonic::Request<super::ListUnbalancedJournalsRequest>,
|
||||||
|
) -> std::result::Result<
|
||||||
|
tonic::Response<super::ListUnbalancedJournalsResponse>,
|
||||||
|
tonic::Status,
|
||||||
|
>;
|
||||||
/// Append one manual debit or credit line to an existing journal.
|
/// Append one manual debit or credit line to an existing journal.
|
||||||
async fn add_journal_line(
|
async fn add_journal_line(
|
||||||
&self,
|
&self,
|
||||||
@@ -515,6 +658,98 @@ pub mod accounting_server {
|
|||||||
};
|
};
|
||||||
Box::pin(fut)
|
Box::pin(fut)
|
||||||
}
|
}
|
||||||
|
"/komp_ac.accounting.Accounting/GetAccountingStatus" => {
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
struct GetAccountingStatusSvc<T: Accounting>(pub Arc<T>);
|
||||||
|
impl<
|
||||||
|
T: Accounting,
|
||||||
|
> tonic::server::UnaryService<super::GetAccountingStatusRequest>
|
||||||
|
for GetAccountingStatusSvc<T> {
|
||||||
|
type Response = super::AccountingStatus;
|
||||||
|
type Future = BoxFuture<
|
||||||
|
tonic::Response<Self::Response>,
|
||||||
|
tonic::Status,
|
||||||
|
>;
|
||||||
|
fn call(
|
||||||
|
&mut self,
|
||||||
|
request: tonic::Request<super::GetAccountingStatusRequest>,
|
||||||
|
) -> Self::Future {
|
||||||
|
let inner = Arc::clone(&self.0);
|
||||||
|
let fut = async move {
|
||||||
|
<T as Accounting>::get_accounting_status(&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 = GetAccountingStatusSvc(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)
|
||||||
|
}
|
||||||
|
"/komp_ac.accounting.Accounting/ListUnbalancedJournals" => {
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
struct ListUnbalancedJournalsSvc<T: Accounting>(pub Arc<T>);
|
||||||
|
impl<
|
||||||
|
T: Accounting,
|
||||||
|
> tonic::server::UnaryService<super::ListUnbalancedJournalsRequest>
|
||||||
|
for ListUnbalancedJournalsSvc<T> {
|
||||||
|
type Response = super::ListUnbalancedJournalsResponse;
|
||||||
|
type Future = BoxFuture<
|
||||||
|
tonic::Response<Self::Response>,
|
||||||
|
tonic::Status,
|
||||||
|
>;
|
||||||
|
fn call(
|
||||||
|
&mut self,
|
||||||
|
request: tonic::Request<super::ListUnbalancedJournalsRequest>,
|
||||||
|
) -> Self::Future {
|
||||||
|
let inner = Arc::clone(&self.0);
|
||||||
|
let fut = async move {
|
||||||
|
<T as Accounting>::list_unbalanced_journals(&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 = ListUnbalancedJournalsSvc(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)
|
||||||
|
}
|
||||||
"/komp_ac.accounting.Accounting/AddJournalLine" => {
|
"/komp_ac.accounting.Accounting/AddJournalLine" => {
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
struct AddJournalLineSvc<T: Accounting>(pub Arc<T>);
|
struct AddJournalLineSvc<T: Accounting>(pub Arc<T>);
|
||||||
|
|||||||
Reference in New Issue
Block a user