fixed doc env vars + mongo v2 migration

This commit is contained in:
Stephan D
2026-01-31 00:26:42 +01:00
parent cbb7bd8ba6
commit 1aa7e287fb
356 changed files with 1705 additions and 1729 deletions

View File

@@ -6,7 +6,7 @@ import (
"github.com/tech/sendico/ledger/storage/model"
pkm "github.com/tech/sendico/pkg/model"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/v2/bson"
)
type storageError string
@@ -31,43 +31,43 @@ type AccountsFilter struct {
// - nil: no filter on owner_ref (return all)
// - pointer to zero ObjectID: filter for accounts where owner_ref is nil
// - pointer to a value: filter for accounts where owner_ref matches
OwnerRefFilter *primitive.ObjectID
OwnerRefFilter *bson.ObjectID
}
type AccountsStore interface {
Create(ctx context.Context, account *pkm.LedgerAccount) error
Get(ctx context.Context, accountRef primitive.ObjectID) (*pkm.LedgerAccount, error)
GetByAccountCode(ctx context.Context, orgRef primitive.ObjectID, accountCode, currency string) (*pkm.LedgerAccount, error)
GetByRole(ctx context.Context, orgRef primitive.ObjectID, currency string, role pkm.AccountRole) (*pkm.LedgerAccount, error)
Get(ctx context.Context, accountRef bson.ObjectID) (*pkm.LedgerAccount, error)
GetByAccountCode(ctx context.Context, orgRef bson.ObjectID, accountCode, currency string) (*pkm.LedgerAccount, error)
GetByRole(ctx context.Context, orgRef bson.ObjectID, currency string, role pkm.AccountRole) (*pkm.LedgerAccount, error)
GetSystemAccount(ctx context.Context, purpose pkm.SystemAccountPurpose, currency string) (*pkm.LedgerAccount, error)
GetDefaultSettlement(ctx context.Context, orgRef primitive.ObjectID, currency string) (*pkm.LedgerAccount, error)
ListByOrganization(ctx context.Context, orgRef primitive.ObjectID, filter *AccountsFilter, limit int, offset int) ([]*pkm.LedgerAccount, error)
UpdateStatus(ctx context.Context, accountRef primitive.ObjectID, status pkm.LedgerAccountStatus) error
GetDefaultSettlement(ctx context.Context, orgRef bson.ObjectID, currency string) (*pkm.LedgerAccount, error)
ListByOrganization(ctx context.Context, orgRef bson.ObjectID, filter *AccountsFilter, limit int, offset int) ([]*pkm.LedgerAccount, error)
UpdateStatus(ctx context.Context, accountRef bson.ObjectID, status pkm.LedgerAccountStatus) error
}
type JournalEntriesStore interface {
Create(ctx context.Context, entry *model.JournalEntry) error
Get(ctx context.Context, entryRef primitive.ObjectID) (*model.JournalEntry, error)
GetByIdempotencyKey(ctx context.Context, orgRef primitive.ObjectID, idempotencyKey string) (*model.JournalEntry, error)
ListByOrganization(ctx context.Context, orgRef primitive.ObjectID, limit int, offset int) ([]*model.JournalEntry, error)
Get(ctx context.Context, entryRef bson.ObjectID) (*model.JournalEntry, error)
GetByIdempotencyKey(ctx context.Context, orgRef bson.ObjectID, idempotencyKey string) (*model.JournalEntry, error)
ListByOrganization(ctx context.Context, orgRef bson.ObjectID, limit int, offset int) ([]*model.JournalEntry, error)
}
type PostingLinesStore interface {
CreateMany(ctx context.Context, lines []*model.PostingLine) error
ListByJournalEntry(ctx context.Context, entryRef primitive.ObjectID) ([]*model.PostingLine, error)
ListByAccount(ctx context.Context, accountRef primitive.ObjectID, limit int, offset int) ([]*model.PostingLine, error)
ListByJournalEntry(ctx context.Context, entryRef bson.ObjectID) ([]*model.PostingLine, error)
ListByAccount(ctx context.Context, accountRef bson.ObjectID, limit int, offset int) ([]*model.PostingLine, error)
}
type BalancesStore interface {
Get(ctx context.Context, accountRef primitive.ObjectID) (*model.AccountBalance, error)
Get(ctx context.Context, accountRef bson.ObjectID) (*model.AccountBalance, error)
Upsert(ctx context.Context, balance *model.AccountBalance) error
IncrementBalance(ctx context.Context, accountRef primitive.ObjectID, amount string) error
IncrementBalance(ctx context.Context, accountRef bson.ObjectID, amount string) error
}
type OutboxStore interface {
Create(ctx context.Context, event *model.OutboxEvent) error
ListPending(ctx context.Context, limit int) ([]*model.OutboxEvent, error)
MarkSent(ctx context.Context, eventRef primitive.ObjectID, sentAt time.Time) error
MarkFailed(ctx context.Context, eventRef primitive.ObjectID) error
IncrementAttempts(ctx context.Context, eventRef primitive.ObjectID) error
MarkSent(ctx context.Context, eventRef bson.ObjectID, sentAt time.Time) error
MarkFailed(ctx context.Context, eventRef bson.ObjectID) error
IncrementAttempts(ctx context.Context, eventRef bson.ObjectID) error
}