fixed doc env vars + mongo v2 migration
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
pmodel "github.com/tech/sendico/pkg/model"
|
||||
connectorv1 "github.com/tech/sendico/pkg/proto/connector/v1"
|
||||
ichainv1 "github.com/tech/sendico/pkg/proto/gateway/chain/v1"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
@@ -299,10 +299,10 @@ func (w *inMemoryWallets) Create(ctx context.Context, wallet *model.ManagedWalle
|
||||
}
|
||||
|
||||
if wallet.WalletRef == "" {
|
||||
wallet.WalletRef = primitive.NewObjectID().Hex()
|
||||
wallet.WalletRef = bson.NewObjectID().Hex()
|
||||
}
|
||||
if wallet.GetID() == nil || wallet.GetID().IsZero() {
|
||||
wallet.SetID(primitive.NewObjectID())
|
||||
wallet.SetID(bson.NewObjectID())
|
||||
} else {
|
||||
wallet.Update()
|
||||
}
|
||||
@@ -352,7 +352,7 @@ func (w *inMemoryWallets) List(ctx context.Context, filter model.ManagedWalletFi
|
||||
|
||||
startIndex := 0
|
||||
if cursor := strings.TrimSpace(filter.Cursor); cursor != "" {
|
||||
if oid, err := primitive.ObjectIDFromHex(cursor); err == nil {
|
||||
if oid, err := bson.ObjectIDFromHex(cursor); err == nil {
|
||||
for idx, item := range items {
|
||||
if item.ID.Timestamp().After(oid.Timestamp()) {
|
||||
startIndex = idx
|
||||
@@ -396,7 +396,7 @@ func (w *inMemoryWallets) SaveBalance(ctx context.Context, balance *model.Wallet
|
||||
existing, ok := w.balances[balance.WalletRef]
|
||||
if !ok {
|
||||
if balance.GetID() == nil || balance.GetID().IsZero() {
|
||||
balance.SetID(primitive.NewObjectID())
|
||||
balance.SetID(bson.NewObjectID())
|
||||
}
|
||||
w.balances[balance.WalletRef] = balance
|
||||
return nil
|
||||
@@ -448,10 +448,10 @@ func (t *inMemoryTransfers) Create(ctx context.Context, transfer *model.Transfer
|
||||
return t.items[ref], merrors.ErrDataConflict
|
||||
}
|
||||
if transfer.TransferRef == "" {
|
||||
transfer.TransferRef = primitive.NewObjectID().Hex()
|
||||
transfer.TransferRef = bson.NewObjectID().Hex()
|
||||
}
|
||||
if transfer.GetID() == nil || transfer.GetID().IsZero() {
|
||||
transfer.SetID(primitive.NewObjectID())
|
||||
transfer.SetID(bson.NewObjectID())
|
||||
} else {
|
||||
transfer.Update()
|
||||
}
|
||||
@@ -493,7 +493,7 @@ func (t *inMemoryTransfers) List(ctx context.Context, filter model.TransferFilte
|
||||
|
||||
start := 0
|
||||
if cursor := strings.TrimSpace(filter.Cursor); cursor != "" {
|
||||
if oid, err := primitive.ObjectIDFromHex(cursor); err == nil {
|
||||
if oid, err := bson.ObjectIDFromHex(cursor); err == nil {
|
||||
for idx, item := range items {
|
||||
if item.ID.Timestamp().After(oid.Timestamp()) {
|
||||
start = idx
|
||||
@@ -575,7 +575,7 @@ func (d *inMemoryDeposits) Record(ctx context.Context, deposit *model.Deposit) e
|
||||
return nil
|
||||
}
|
||||
if deposit.GetID() == nil || deposit.GetID().IsZero() {
|
||||
deposit.SetID(primitive.NewObjectID())
|
||||
deposit.SetID(bson.NewObjectID())
|
||||
}
|
||||
if deposit.ObservedAt.IsZero() {
|
||||
deposit.ObservedAt = time.Now().UTC()
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
pmodel "github.com/tech/sendico/pkg/model"
|
||||
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
|
||||
chainv1 "github.com/tech/sendico/pkg/proto/gateway/chain/v1"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
// CloneMoney defensively copies a Money proto.
|
||||
@@ -43,11 +43,11 @@ func ResolveContractAddress(tokens []TokenContract, symbol string) string {
|
||||
}
|
||||
|
||||
func GenerateWalletRef() string {
|
||||
return primitive.NewObjectID().Hex()
|
||||
return bson.NewObjectID().Hex()
|
||||
}
|
||||
|
||||
func GenerateTransferRef() string {
|
||||
return primitive.NewObjectID().Hex()
|
||||
return bson.NewObjectID().Hex()
|
||||
}
|
||||
|
||||
func ChainKeyFromEnum(chain chainv1.ChainNetwork) (string, chainv1.ChainNetwork) {
|
||||
|
||||
Reference in New Issue
Block a user