85 lines
2.2 KiB
Protocol Buffer
85 lines
2.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
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);
|
|
|
|
// Return journal lines and credits-minus-debits informational balance.
|
|
rpc GetJournal(GetJournalRequest) returns (Journal);
|
|
|
|
// 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);
|
|
}
|
|
|
|
// Tables with an active posting script accept journal_id as a reserved key in
|
|
// PostTableDataRequest.data. It selects the journal receiving generated lines
|
|
// and is removed before the source row is validated or stored.
|
|
|
|
enum JournalSide {
|
|
JOURNAL_SIDE_UNSPECIFIED = 0;
|
|
JOURNAL_SIDE_DEBIT = 1;
|
|
JOURNAL_SIDE_CREDIT = 2;
|
|
}
|
|
|
|
message CreateJournalRequest {
|
|
string profile_name = 1;
|
|
string currency = 2;
|
|
string description = 3;
|
|
}
|
|
|
|
message GetJournalRequest {
|
|
string profile_name = 1;
|
|
int64 journal_id = 2;
|
|
bool include_deleted = 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;
|
|
int64 journal_line_id = 3;
|
|
}
|
|
|
|
message JournalLine {
|
|
int64 id = 1;
|
|
int32 line_number = 2;
|
|
JournalSide side = 3;
|
|
string account_code = 4;
|
|
string amount = 5;
|
|
string description = 6;
|
|
bool deleted = 7;
|
|
string created_at = 8;
|
|
string deleted_at = 9;
|
|
string source_table_name = 10;
|
|
int64 source_record_id = 11;
|
|
int64 source_row_revision = 12;
|
|
int64 posting_script_id = 13;
|
|
}
|
|
|
|
message Journal {
|
|
int64 id = 1;
|
|
string profile_name = 2;
|
|
string currency = 3;
|
|
string description = 4;
|
|
string created_at = 5;
|
|
repeated JournalLine lines = 6;
|
|
string total_debit = 7;
|
|
string total_credit = 8;
|
|
// Informational difference calculated as credits minus debits.
|
|
string balance = 9;
|
|
}
|