accounting kernel4

This commit is contained in:
Priec
2026-07-20 17:44:54 +02:00
parent c70360532c
commit 8b14e4d6d6
7 changed files with 264 additions and 156 deletions

View File

@@ -4,8 +4,9 @@ package komp_ac.accounting;
// Mutable informational journals. A journal may contain only debits, only
// credits, or any non-zero balance. Balance is reported but never enforced.
service Accounting {
// Create an empty journal and return its generated journal_id.
rpc CreateJournal(CreateJournalRequest) returns (Journal);
// Create a journal with its first lines when journal_id is absent, or append
// all supplied lines atomically when journal_id identifies an existing one.
rpc PostJournal(PostJournalRequest) returns (Journal);
// Return journal lines and credits-minus-debits informational balance.
rpc GetJournal(GetJournalRequest) returns (Journal);
@@ -17,9 +18,6 @@ service Accounting {
rpc ListUnbalancedJournals(ListUnbalancedJournalsRequest)
returns (ListUnbalancedJournalsResponse);
// Append one manual debit or credit line to an existing journal.
rpc AddJournalLine(AddJournalLineRequest) returns (Journal);
// Soft-delete one line while retaining it for audit display.
rpc SoftDeleteJournalLine(SoftDeleteJournalLineRequest) returns (Journal);
}
@@ -34,10 +32,30 @@ enum JournalSide {
JOURNAL_SIDE_CREDIT = 2;
}
message CreateJournalRequest {
message PostJournalRequest {
string profile_name = 1;
string currency = 2;
string description = 3;
// Absent creates a new journal. Present must identify an existing journal;
// an unknown id is never treated as a request to create one.
optional int64 journal_id = 2;
// Required when creating. When appending, empty uses the journal currency;
// a supplied value must match it exactly.
string currency = 3;
// Applied when creating and required to be empty when appending.
string description = 4;
// At least one line is required. The lines are inserted atomically and the
// journal is allowed to remain unbalanced.
repeated JournalLineInput lines = 5;
}
message JournalLineInput {
JournalSide side = 1;
string account_code = 2;
string amount = 3;
string description = 4;
}
message GetJournalRequest {
@@ -98,15 +116,6 @@ message ListUnbalancedJournalsResponse {
string next_page_token = 3;
}
message AddJournalLineRequest {
string profile_name = 1;
int64 journal_id = 2;
JournalSide side = 3;
string account_code = 4;
string amount = 5;
string description = 6;
}
message SoftDeleteJournalLineRequest {
string profile_name = 1;
int64 journal_id = 2;