unified code verification service
This commit is contained in:
@@ -31,7 +31,7 @@ func (s *Service) blockAccountResponder(_ context.Context, req *ledgerv1.BlockAc
|
||||
return nil, err
|
||||
}
|
||||
|
||||
logger := s.logger.With(mzap.ObjRef("account_ref", accountRef))
|
||||
logger := s.logger.With(mzap.AccRef(accountRef))
|
||||
|
||||
account, err := s.storage.Accounts().Get(ctx, accountRef)
|
||||
if err != nil {
|
||||
@@ -61,7 +61,7 @@ func (s *Service) blockAccountResponder(_ context.Context, req *ledgerv1.BlockAc
|
||||
}
|
||||
|
||||
if account.Status == pmodel.LedgerAccountStatusFrozen {
|
||||
logger.Debug("account already frozen", mzap.ObjRef("account_ref", accountRef))
|
||||
logger.Debug("account already frozen", mzap.AccRef(accountRef))
|
||||
return &ledgerv1.BlockAccountResponse{Account: toProtoAccount(account)}, nil
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ func (s *Service) blockAccountResponder(_ context.Context, req *ledgerv1.BlockAc
|
||||
}
|
||||
|
||||
account.Status = pmodel.LedgerAccountStatusFrozen
|
||||
logger.Info("account blocked (frozen)", mzap.ObjRef("account_ref", accountRef))
|
||||
logger.Info("account blocked (frozen)", mzap.AccRef(accountRef))
|
||||
return &ledgerv1.BlockAccountResponse{Account: toProtoAccount(account)}, nil
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ func (s *Service) unblockAccountResponder(_ context.Context, req *ledgerv1.Unblo
|
||||
return nil, err
|
||||
}
|
||||
|
||||
logger := s.logger.With(mzap.ObjRef("account_ref", accountRef))
|
||||
logger := s.logger.With(mzap.AccRef(accountRef))
|
||||
|
||||
account, err := s.storage.Accounts().Get(ctx, accountRef)
|
||||
if err != nil {
|
||||
@@ -124,7 +124,7 @@ func (s *Service) unblockAccountResponder(_ context.Context, req *ledgerv1.Unblo
|
||||
}
|
||||
|
||||
if account.Status == pmodel.LedgerAccountStatusActive {
|
||||
logger.Debug("account already active", mzap.ObjRef("account_ref", accountRef))
|
||||
logger.Debug("account already active", mzap.AccRef(accountRef))
|
||||
return &ledgerv1.UnblockAccountResponse{Account: toProtoAccount(account)}, nil
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ func (s *Service) unblockAccountResponder(_ context.Context, req *ledgerv1.Unblo
|
||||
}
|
||||
|
||||
account.Status = pmodel.LedgerAccountStatusActive
|
||||
logger.Info("account unblocked (active)", mzap.ObjRef("account_ref", accountRef))
|
||||
logger.Info("account unblocked (active)", mzap.AccRef(accountRef))
|
||||
return &ledgerv1.UnblockAccountResponse{Account: toProtoAccount(account)}, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ func (s *Service) upsertBalances(ctx context.Context, lines []*model.PostingLine
|
||||
for accountRef, delta := range balanceDeltas {
|
||||
account := accounts[accountRef]
|
||||
if account == nil {
|
||||
s.logger.Warn("account cache missing for balance update", mzap.ObjRef("account_ref", accountRef))
|
||||
s.logger.Warn("account cache missing for balance update", mzap.AccRef(accountRef))
|
||||
return merrors.Internal("account cache missing for balance update")
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ func (s *Service) upsertBalances(ctx context.Context, lines []*model.PostingLine
|
||||
if err != nil && !errors.Is(err, storage.ErrBalanceNotFound) {
|
||||
s.logger.Warn("failed to fetch account balance",
|
||||
zap.Error(err),
|
||||
mzap.ObjRef("account_ref", accountRef))
|
||||
mzap.AccRef(accountRef))
|
||||
return merrors.Internal("failed to update balance")
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ func (s *Service) upsertBalances(ctx context.Context, lines []*model.PostingLine
|
||||
}
|
||||
|
||||
if err := balancesStore.Upsert(ctx, newBalance); err != nil {
|
||||
s.logger.Warn("failed to upsert account balance", zap.Error(err), mzap.ObjRef("account_ref", accountRef))
|
||||
s.logger.Warn("failed to upsert account balance", zap.Error(err), mzap.AccRef(accountRef))
|
||||
return merrors.Internal("failed to update balance")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user