fix wallet creation without vaultEntries

This commit is contained in:
k00b 2024-10-31 17:54:47 -05:00
parent 1f71a9e187
commit 7b4a33b354
2 changed files with 9 additions and 6 deletions

View File

@ -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 }))
}
}
}
: {})
}
})
)

View File

@ -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')