service backend
This commit is contained in:
25
api/ledger/storage/model/account.go
Normal file
25
api/ledger/storage/model/account.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/tech/sendico/pkg/db/storable"
|
||||
"github.com/tech/sendico/pkg/model"
|
||||
)
|
||||
|
||||
// Account represents a ledger account that holds balances for a specific currency.
|
||||
type Account struct {
|
||||
storable.Base `bson:",inline" json:",inline"`
|
||||
model.PermissionBound `bson:",inline" json:",inline"`
|
||||
|
||||
AccountCode string `bson:"accountCode" json:"accountCode"` // e.g., "asset:cash:usd"
|
||||
Currency string `bson:"currency" json:"currency"` // ISO 4217 currency code
|
||||
AccountType AccountType `bson:"accountType" json:"accountType"` // asset, liability, revenue, expense
|
||||
Status AccountStatus `bson:"status" json:"status"` // active, frozen, closed
|
||||
AllowNegative bool `bson:"allowNegative" json:"allowNegative"` // debit policy: allow negative balances
|
||||
IsSettlement bool `bson:"isSettlement,omitempty" json:"isSettlement,omitempty"` // marks org-level default contra account
|
||||
Metadata map[string]string `bson:"metadata,omitempty" json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
// Collection implements storable.Storable.
|
||||
func (*Account) Collection() string {
|
||||
return AccountsCollection
|
||||
}
|
||||
Reference in New Issue
Block a user