unified code verification service
This commit is contained in:
@@ -124,14 +124,14 @@ func (a *accountsStore) Get(ctx context.Context, accountRef bson.ObjectID) (*pkm
|
||||
result := &pkm.LedgerAccount{}
|
||||
if err := a.repo.Get(ctx, accountRef, result); err != nil {
|
||||
if errors.Is(err, merrors.ErrNoData) {
|
||||
a.logger.Debug("Account not found", mzap.ObjRef("account_ref", accountRef))
|
||||
a.logger.Debug("Account not found", mzap.AccRef(accountRef))
|
||||
return nil, storage.ErrAccountNotFound
|
||||
}
|
||||
a.logger.Warn("Failed to get account", zap.Error(err), mzap.ObjRef("account_ref", accountRef))
|
||||
a.logger.Warn("Failed to get account", zap.Error(err), mzap.AccRef(accountRef))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
a.logger.Debug("Account loaded", mzap.ObjRef("account_ref", accountRef), zap.String("account_code", result.AccountCode))
|
||||
a.logger.Debug("Account loaded", mzap.AccRef(accountRef), zap.String("account_code", result.AccountCode))
|
||||
return result, nil
|
||||
}
|
||||
|
||||
@@ -325,10 +325,10 @@ func (a *accountsStore) UpdateStatus(ctx context.Context, accountRef bson.Object
|
||||
|
||||
patch := repository.Patch().Set(repository.Field("status"), status)
|
||||
if err := a.repo.Patch(ctx, accountRef, patch); err != nil {
|
||||
a.logger.Warn("Failed to update account status", zap.Error(err), mzap.ObjRef("account_ref", accountRef))
|
||||
a.logger.Warn("Failed to update account status", zap.Error(err), mzap.AccRef(accountRef))
|
||||
return err
|
||||
}
|
||||
|
||||
a.logger.Debug("Account status updated", mzap.ObjRef("account_ref", accountRef), zap.String("status", string(status)))
|
||||
a.logger.Debug("Account status updated", mzap.AccRef(accountRef), zap.String("status", string(status)))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -56,14 +56,14 @@ func (b *balancesStore) Get(ctx context.Context, accountRef bson.ObjectID) (*mod
|
||||
result := &model.AccountBalance{}
|
||||
if err := b.repo.FindOneByFilter(ctx, query, result); err != nil {
|
||||
if errors.Is(err, merrors.ErrNoData) {
|
||||
b.logger.Debug("balance not found", mzap.ObjRef("account_ref", accountRef))
|
||||
b.logger.Debug("balance not found", mzap.AccRef(accountRef))
|
||||
return nil, storage.ErrBalanceNotFound
|
||||
}
|
||||
b.logger.Warn("failed to get balance", zap.Error(err), mzap.ObjRef("account_ref", accountRef))
|
||||
b.logger.Warn("failed to get balance", zap.Error(err), mzap.AccRef(accountRef))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
b.logger.Debug("balance loaded", mzap.ObjRef("account_ref", accountRef),
|
||||
b.logger.Debug("balance loaded", mzap.AccRef(accountRef),
|
||||
zap.String("balance", result.Balance))
|
||||
return result, nil
|
||||
}
|
||||
|
||||
@@ -130,10 +130,10 @@ func (p *postingLinesStore) ListByAccount(ctx context.Context, accountRef bson.O
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
p.logger.Warn("failed to list posting lines by account", zap.Error(err), mzap.ObjRef("account_ref", accountRef))
|
||||
p.logger.Warn("failed to list posting lines by account", zap.Error(err), mzap.AccRef(accountRef))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
p.logger.Debug("listed posting lines by account", zap.Int("count", len(lines)), mzap.ObjRef("account_ref", accountRef))
|
||||
p.logger.Debug("listed posting lines by account", zap.Int("count", len(lines)), mzap.AccRef(accountRef))
|
||||
return lines, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user