This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const q = require('q'), | |
_ = require('lodash'); | |
module.exports = async function() { | |
const self = this; | |
if (!self.facebookPageId) { | |
return q.reject(new Error(`Cannot get content - no facebook page ID for ${self.id}`)); | |
} | |
await self.getFacebookTokens(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(attribute, start, end) { | |
let self = this; | |
let interval = {}; | |
if (!end) { | |
// end = today | |
interval['end'] = parseInt(self[attribute]); | |
} else { | |
// Else, get end value: first value less than equal to end | |
return global.db.models.SocialUpdate.findOne({ |