service backend
All checks were successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful

This commit is contained in:
Stephan D
2025-11-07 18:35:26 +01:00
parent 20e8f9acc4
commit 62a6631b9a
537 changed files with 48453 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package model
import (
"time"
"github.com/tech/sendico/pkg/db/storable"
"github.com/tech/sendico/pkg/model"
)
// JournalEntry represents an atomic ledger transaction with multiple posting lines.
type JournalEntry struct {
storable.Base `bson:",inline" json:",inline"`
model.PermissionBound `bson:",inline" json:",inline"`
IdempotencyKey string `bson:"idempotencyKey" json:"idempotencyKey"` // unique key for deduplication
EventTime time.Time `bson:"eventTime" json:"eventTime"` // business event timestamp
EntryType EntryType `bson:"entryType" json:"entryType"` // credit, debit, transfer, fx, fee, adjust, reverse
Description string `bson:"description" json:"description"`
Metadata map[string]string `bson:"metadata,omitempty" json:"metadata,omitempty"`
Version int64 `bson:"version" json:"version"` // for ordering and optimistic locking
}
// Collection implements storable.Storable.
func (*JournalEntry) Collection() string {
return JournalEntriesCollection
}