diff --git a/utils/lndJobs.js b/utils/lndJobs.js index d5b36b11..7502e115 100644 --- a/utils/lndJobs.js +++ b/utils/lndJobs.js @@ -36,18 +36,14 @@ const _lookupInvoice = hash => }) }) -const _getPostTipInfo = ({ postID, page }) => +const _getPostTipInfo = ({ postID }) => new Promise((resolve, reject) => { getUser() - .get(Key.WALL) - .get(Key.PAGES) - .get(page) - .get(Key.POSTS) + .get(Key.POSTS_NEW) .get(postID) .once(post => { if (post && post.date) { const { tipCounter, tipValue } = post - console.log(post) resolve({ tipCounter: typeof tipCounter === 'number' ? tipCounter : 0, tipValue: typeof tipValue === 'number' ? tipValue : 0 @@ -58,7 +54,7 @@ const _getPostTipInfo = ({ postID, page }) => }) }) -const _incrementPost = ({ postID, page, orderAmount }) => +const _incrementPost = ({ postID, orderAmount }) => new Promise((resolve, reject) => { const parsedAmount = parseFloat(orderAmount) @@ -69,7 +65,7 @@ const _incrementPost = ({ postID, page, orderAmount }) => Logger.info('[POST TIP] Getting Post Tip Values...') - return _getPostTipInfo({ postID, page }) + return _getPostTipInfo({ postID }) .then(({ tipValue, tipCounter }) => { const updatedTip = { tipCounter: tipCounter + 1, @@ -77,10 +73,7 @@ const _incrementPost = ({ postID, page, orderAmount }) => } getUser() - .get(Key.WALL) - .get(Key.PAGES) - .get(page) - .get(Key.POSTS) + .get(Key.POSTS_NEW) .get(postID) .put(updatedTip, () => { Logger.info('[POST TIP] Successfully updated Post tip info') @@ -158,7 +151,6 @@ const executeTipAction = (tip, invoice) => { if (tip.targetType === 'post') { _incrementPost({ postID: tip.postID, - page: tip.postPage, orderAmount: invoice.amt_paid_sat }) }