Files
sendico/api/ledger/storage/model/journal_entry.go
Stephan D 62a6631b9a
All checks were successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
service backend
2025-11-07 18:35:26 +01:00

27 lines
1.1 KiB
Go

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
}