service backend
This commit is contained in:
26
api/ledger/storage/model/journal_entry.go
Normal file
26
api/ledger/storage/model/journal_entry.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user