Created
September 16, 2015 04:45
-
-
Save digitalsadhu/792a789283f5c577b000 to your computer and use it in GitHub Desktop.
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
var findContract = _.flip(_.wrapCallback(Contract.findById.bind(Contract)), {remoteCtx: ctx}); | |
var findContractPeriods = _.flip(_.wrapCallback(ContractPeriod.find.bind(ContractPeriod)), {remoteCtx: ctx}); | |
var findContractPeriod = _.flip(_.wrapCallback(ContractPeriod.findById.bind(ContractPeriod)), {remoteCtx: ctx}); | |
var findReviews = _.flip(_.wrapCallback(Review.find.bind(Review)), {remoteCtx: ctx}); | |
var sendEmail = _.wrapCallback(sendReminderEmail); | |
var contractPeriodStream1 = findReviews(query).flatten().pluck('contractPeriodId').map(findContractPeriod); | |
var contractPeriodStream2 = findContractPeriods(query).flatten(); | |
contractPeriodStream1.merge(contractPeriodStream2) | |
.pluck('contractId').uniq() | |
.map(findContract).flatten() | |
.map(sendEmail).flatten() | |
.errors(cb) | |
.done(cb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment