accounting kernel3
This commit is contained in:
Binary file not shown.
@@ -18,6 +18,73 @@ pub struct GetJournalRequest {
|
||||
pub include_deleted: bool,
|
||||
}
|
||||
#[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 {
|
||||
#[prost(string, tag = "1")]
|
||||
pub profile_name: ::prost::alloc::string::String,
|
||||
@@ -260,6 +327,66 @@ pub mod accounting_client {
|
||||
.insert(GrpcMethod::new("komp_ac.accounting.Accounting", "GetJournal"));
|
||||
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.
|
||||
pub async fn add_journal_line(
|
||||
&mut self,
|
||||
@@ -336,6 +463,22 @@ pub mod accounting_server {
|
||||
&self,
|
||||
request: tonic::Request<super::GetJournalRequest>,
|
||||
) -> 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.
|
||||
async fn add_journal_line(
|
||||
&self,
|
||||
@@ -515,6 +658,98 @@ pub mod accounting_server {
|
||||
};
|
||||
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" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct AddJournalLineSvc<T: Accounting>(pub Arc<T>);
|
||||
|
||||
Reference in New Issue
Block a user