From 7b4a33b3543ba49ca347441bc771a9295b29cde2 Mon Sep 17 00:00:00 2001 From: k00b Date: Thu, 31 Oct 2024 17:54:47 -0500 Subject: [PATCH] fix wallet creation without vaultEntries --- api/resolvers/wallet.js | 14 +++++++++----- wallets/lnbits/index.js | 1 - 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/api/resolvers/wallet.js b/api/resolvers/wallet.js index 268b4ad9..88a064b9 100644 --- a/api/resolvers/wallet.js +++ b/api/resolvers/wallet.js @@ -743,11 +743,15 @@ async function upsertWallet ( type: wallet.type, // client only wallets has no walletData ...(Object.keys(walletData).length > 0 ? { [wallet.field]: { create: walletData } } : {}), - vaultEntries: { - createMany: { - data: vaultEntries?.map(({ key, iv, value }) => ({ key, iv, value, userId: me.id })) - } - } + ...(vaultEntries + ? { + vaultEntries: { + createMany: { + data: vaultEntries?.map(({ key, iv, value }) => ({ key, iv, value, userId: me.id })) + } + } + } + : {}) } }) ) diff --git a/wallets/lnbits/index.js b/wallets/lnbits/index.js index 008c072f..3dcc8af1 100644 --- a/wallets/lnbits/index.js +++ b/wallets/lnbits/index.js @@ -10,7 +10,6 @@ export const fields = [ name: 'url', label: 'lnbits url', type: 'text', - required: true, validate: process.env.NODE_ENV === 'development' ? string() .or([string().matches(/^(http:\/\/)?localhost:\d+$/), string().url()], 'invalid url')