chore: update project changes

This commit is contained in:
2026-09-21 15:33:47 +03:30
parent f7366a1985
commit 810448b6e7
8 changed files with 1459 additions and 810 deletions
+34 -7
View File
@@ -13,10 +13,11 @@ import (
)
const (
recentJournalLimit = 12
transactionPageSize = 20
topAssetLimit = 5
topHoldersPerAsset = 5
recentJournalLimit = 12
recentSettlementLimit = 12
transactionPageSize = 20
topAssetLimit = 5
topHoldersPerAsset = 5
)
type Stats struct {
@@ -26,6 +27,25 @@ type Stats struct {
LastRecordedAt time.Time
}
type SettlementStats struct {
Pending int64
Retryable int64
Confirmed int64
ManualReview int64
}
type Settlement struct {
ID string
SourceService string
SourceTransactionID string
Status ledger.SettlementStatus
Network string
TransactionHash string
Attempts int
LastError string
UpdatedAt time.Time
}
type Holder struct {
Rank int64
OwnerType string
@@ -47,6 +67,7 @@ type Repository interface {
GetByID(context.Context, string) (ledger.Journal, error)
Balance(context.Context, ledger.AccountReference, time.Time) (ledger.Amount, error)
TopHolders(context.Context, int, int) ([]Holder, error)
SettlementDashboard(context.Context, int) (SettlementStats, []Settlement, error)
}
type Service struct {
@@ -54,8 +75,10 @@ type Service struct {
}
type Dashboard struct {
Stats Stats
Journals []ledger.Journal
Stats Stats
Journals []ledger.Journal
SettlementStats SettlementStats
Settlements []Settlement
}
type Assets struct {
@@ -100,7 +123,11 @@ func (s *Service) Dashboard(ctx context.Context) (Dashboard, error) {
if err != nil {
return Dashboard{}, fmt.Errorf("read recent journals: %w", err)
}
return Dashboard{Stats: stats, Journals: journals}, nil
settlementStats, settlements, err := s.repository.SettlementDashboard(ctx, recentSettlementLimit)
if err != nil {
return Dashboard{}, fmt.Errorf("read settlement dashboard: %w", err)
}
return Dashboard{Stats: stats, Journals: journals, SettlementStats: settlementStats, Settlements: settlements}, nil
}
func (s *Service) Assets(ctx context.Context) (Assets, error) {