From 2079b4f9846cadcdccb9e82f92fa4f8c15cc76fb Mon Sep 17 00:00:00 2001 From: hatim boufnichel Date: Sat, 2 Jan 2021 17:21:44 +0100 Subject: [PATCH] update struct --- services/schema/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/schema/index.js b/services/schema/index.js index 56f2c04d..8753a5db 100644 --- a/services/schema/index.js +++ b/services/schema/index.js @@ -11,8 +11,8 @@ const Key = require('../gunDB/contact-api/key') * @typedef {object} CoordinateOrder * @prop {string} fromLndPub * @prop {string} toLndPub - * @prop {string} fromGunPub - * @prop {string} toGunPub + * @prop {string=} fromGunPub can be optional, if the payment/invoice is not related to an order + * @prop {string=} toGunPub can be optional, if the payment/invoice is not related to an order * @prop {boolean} inbound * * @prop {string=} ownerGunPub Reserved for buddy system: @@ -55,10 +55,10 @@ const checkOrderInfo = (order = {}) => { if (typeof toLndPub !== 'string' || toLndPub === '') { return 'invalid or no "toLndPub" field provided to order coordinate' } - if (typeof fromGunPub !== 'string' || fromGunPub === '') { + if (fromGunPub && (typeof fromGunPub !== 'string' || fromGunPub === '')) { return 'invalid or no "fromGunPub" field provided to order coordinate' } - if (typeof toGunPub !== 'string' || toGunPub === '') { + if (toGunPub && (typeof toGunPub !== 'string' || toGunPub === '')) { return 'invalid or no "toGunPub" field provided to order coordinate' } if (typeof inbound !== 'boolean') {