removing crap2

This commit is contained in:
Priec
2026-07-26 19:30:21 +02:00
parent 5ee8f0b02f
commit 32552ad3b6
4 changed files with 148 additions and 46 deletions

View File

@@ -39,10 +39,15 @@ service Accounting {
returns (AccountingPeriod);
// Closing snapshots balances and blocks mutations through the period end.
// A closed period may be reopened; approval makes it final.
// A closed period may be reopened until the profile is approved.
rpc CloseAccountingPeriod(CloseAccountingPeriodRequest) returns (AccountingPeriod);
rpc ReopenAccountingPeriod(ReopenAccountingPeriodRequest) returns (AccountingPeriod);
rpc ApproveAccountingPeriod(ApproveAccountingPeriodRequest) returns (AccountingPeriod);
// Approves the profile's financial statement. One profile is one accounting
// period, and approval happens once for it, not once per period inside it.
// Every period must be closed first, and none may be reopened afterwards.
rpc ApproveProfile(ApproveProfileRequest) returns (ProfileApproval);
rpc GetProfileApproval(GetProfileApprovalRequest) returns (ProfileApproval);
rpc GetAccountingPeriod(GetAccountingPeriodRequest) returns (AccountingPeriod);
rpc ListAccountingPeriods(ListAccountingPeriodsRequest)
@@ -56,11 +61,12 @@ enum JournalSide {
JOURNAL_SIDE_CREDIT = 2;
}
// A period is only ever open or closed. Approval is a fact about the whole
// profile, because the profile is the accounting period being reported on.
enum AccountingPeriodStatus {
ACCOUNTING_PERIOD_STATUS_UNSPECIFIED = 0;
ACCOUNTING_PERIOD_STATUS_OPEN = 1;
ACCOUNTING_PERIOD_STATUS_CLOSED = 2;
ACCOUNTING_PERIOD_STATUS_APPROVED = 3;
}
// How long one accounting period lasts. MONTH and YEAR span whole months, so
@@ -261,7 +267,6 @@ message ConfigureAccountingPeriodRequest {
string profile_name = 1;
// First day of the period, YYYY-MM-DD. Must be the first day of a month.
string period_start = 2;
reserved 3;
// Optional link to the preceding period in a carry chain.
optional int64 previous_period_id = 4;
// Required. Decides the length of the period.
@@ -279,8 +284,21 @@ message ReopenAccountingPeriodRequest {
int64 period_id = 1;
}
message ApproveAccountingPeriodRequest {
int64 period_id = 1;
message ApproveProfileRequest {
string profile_name = 1;
}
message GetProfileApprovalRequest {
string profile_name = 1;
}
// Approval state of one profile's financial statement.
message ProfileApproval {
string profile_name = 1;
bool approved = 2;
// Empty while the profile is unapproved.
string approved_at = 3;
string approved_by_user_id = 4;
}
message GetAccountingPeriodRequest {
@@ -304,8 +322,6 @@ message AccountingPeriod {
int64 previous_period_id = 6;
string closed_at = 7;
string closed_by_user_id = 8;
string approved_at = 9;
string approved_by_user_id = 10;
AccountingPeriodType period_type = 11;
}

Binary file not shown.

View File

@@ -280,10 +280,28 @@ pub struct ReopenAccountingPeriodRequest {
#[prost(int64, tag = "1")]
pub period_id: i64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ApproveAccountingPeriodRequest {
#[prost(int64, tag = "1")]
pub period_id: i64,
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ApproveProfileRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetProfileApprovalRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
}
/// Approval state of one profile's financial statement.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ProfileApproval {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
#[prost(bool, tag = "2")]
pub approved: bool,
/// Empty while the profile is unapproved.
#[prost(string, tag = "3")]
pub approved_at: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub approved_by_user_id: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetAccountingPeriodRequest {
@@ -318,10 +336,6 @@ pub struct AccountingPeriod {
pub closed_at: ::prost::alloc::string::String,
#[prost(string, tag = "8")]
pub closed_by_user_id: ::prost::alloc::string::String,
#[prost(string, tag = "9")]
pub approved_at: ::prost::alloc::string::String,
#[prost(string, tag = "10")]
pub approved_by_user_id: ::prost::alloc::string::String,
#[prost(enumeration = "AccountingPeriodType", tag = "11")]
pub period_type: i32,
}
@@ -382,13 +396,14 @@ impl JournalSide {
}
}
}
/// A period is only ever open or closed. Approval is a fact about the whole
/// profile, because the profile is the accounting period being reported on.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum AccountingPeriodStatus {
Unspecified = 0,
Open = 1,
Closed = 2,
Approved = 3,
}
impl AccountingPeriodStatus {
/// String value of the enum field names used in the ProtoBuf definition.
@@ -400,7 +415,6 @@ impl AccountingPeriodStatus {
Self::Unspecified => "ACCOUNTING_PERIOD_STATUS_UNSPECIFIED",
Self::Open => "ACCOUNTING_PERIOD_STATUS_OPEN",
Self::Closed => "ACCOUNTING_PERIOD_STATUS_CLOSED",
Self::Approved => "ACCOUNTING_PERIOD_STATUS_APPROVED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
@@ -409,7 +423,6 @@ impl AccountingPeriodStatus {
"ACCOUNTING_PERIOD_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"ACCOUNTING_PERIOD_STATUS_OPEN" => Some(Self::Open),
"ACCOUNTING_PERIOD_STATUS_CLOSED" => Some(Self::Closed),
"ACCOUNTING_PERIOD_STATUS_APPROVED" => Some(Self::Approved),
_ => None,
}
}
@@ -790,7 +803,7 @@ pub mod accounting_client {
self.inner.unary(req, path, codec).await
}
/// Closing snapshots balances and blocks mutations through the period end.
/// A closed period may be reopened; approval makes it final.
/// A closed period may be reopened until the profile is approved.
pub async fn close_accounting_period(
&mut self,
request: impl tonic::IntoRequest<super::CloseAccountingPeriodRequest>,
@@ -849,11 +862,14 @@ pub mod accounting_client {
);
self.inner.unary(req, path, codec).await
}
pub async fn approve_accounting_period(
/// Approves the profile's financial statement. One profile is one accounting
/// period, and approval happens once for it, not once per period inside it.
/// Every period must be closed first, and none may be reopened afterwards.
pub async fn approve_profile(
&mut self,
request: impl tonic::IntoRequest<super::ApproveAccountingPeriodRequest>,
request: impl tonic::IntoRequest<super::ApproveProfileRequest>,
) -> std::result::Result<
tonic::Response<super::AccountingPeriod>,
tonic::Response<super::ProfileApproval>,
tonic::Status,
> {
self.inner
@@ -866,14 +882,40 @@ pub mod accounting_client {
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.accounting.Accounting/ApproveAccountingPeriod",
"/komp_ac.accounting.Accounting/ApproveProfile",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.accounting.Accounting", "ApproveProfile"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_profile_approval(
&mut self,
request: impl tonic::IntoRequest<super::GetProfileApprovalRequest>,
) -> std::result::Result<
tonic::Response<super::ProfileApproval>,
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/GetProfileApproval",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"komp_ac.accounting.Accounting",
"ApproveAccountingPeriod",
"GetProfileApproval",
),
);
self.inner.unary(req, path, codec).await
@@ -1041,7 +1083,7 @@ pub mod accounting_server {
tonic::Status,
>;
/// Closing snapshots balances and blocks mutations through the period end.
/// A closed period may be reopened; approval makes it final.
/// A closed period may be reopened until the profile is approved.
async fn close_accounting_period(
&self,
request: tonic::Request<super::CloseAccountingPeriodRequest>,
@@ -1056,13 +1098,17 @@ pub mod accounting_server {
tonic::Response<super::AccountingPeriod>,
tonic::Status,
>;
async fn approve_accounting_period(
/// Approves the profile's financial statement. One profile is one accounting
/// period, and approval happens once for it, not once per period inside it.
/// Every period must be closed first, and none may be reopened afterwards.
async fn approve_profile(
&self,
request: tonic::Request<super::ApproveAccountingPeriodRequest>,
) -> std::result::Result<
tonic::Response<super::AccountingPeriod>,
tonic::Status,
>;
request: tonic::Request<super::ApproveProfileRequest>,
) -> std::result::Result<tonic::Response<super::ProfileApproval>, tonic::Status>;
async fn get_profile_approval(
&self,
request: tonic::Request<super::GetProfileApprovalRequest>,
) -> std::result::Result<tonic::Response<super::ProfileApproval>, tonic::Status>;
async fn get_accounting_period(
&self,
request: tonic::Request<super::GetAccountingPeriodRequest>,
@@ -1673,30 +1719,70 @@ pub mod accounting_server {
};
Box::pin(fut)
}
"/komp_ac.accounting.Accounting/ApproveAccountingPeriod" => {
"/komp_ac.accounting.Accounting/ApproveProfile" => {
#[allow(non_camel_case_types)]
struct ApproveAccountingPeriodSvc<T: Accounting>(pub Arc<T>);
struct ApproveProfileSvc<T: Accounting>(pub Arc<T>);
impl<
T: Accounting,
> tonic::server::UnaryService<super::ApproveAccountingPeriodRequest>
for ApproveAccountingPeriodSvc<T> {
type Response = super::AccountingPeriod;
> tonic::server::UnaryService<super::ApproveProfileRequest>
for ApproveProfileSvc<T> {
type Response = super::ProfileApproval;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::ApproveAccountingPeriodRequest,
>,
request: tonic::Request<super::ApproveProfileRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Accounting>::approve_accounting_period(
&inner,
request,
)
<T as Accounting>::approve_profile(&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 = ApproveProfileSvc(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/GetProfileApproval" => {
#[allow(non_camel_case_types)]
struct GetProfileApprovalSvc<T: Accounting>(pub Arc<T>);
impl<
T: Accounting,
> tonic::server::UnaryService<super::GetProfileApprovalRequest>
for GetProfileApprovalSvc<T> {
type Response = super::ProfileApproval;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetProfileApprovalRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Accounting>::get_profile_approval(&inner, request)
.await
};
Box::pin(fut)
@@ -1708,7 +1794,7 @@ pub mod accounting_server {
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ApproveAccountingPeriodSvc(inner);
let method = GetProfileApprovalSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(

2
server

Submodule server updated: 828c3382b9...7a1a8f9742