2 * Broadcast updates to client when the model changes
7 var User = require('../../models').User;
8 var FaxRoom = require('../../models').FaxRoom;
9 var FaxQueue = require('../../models').FaxQueue;
10 var FaxAccount = require('../../models').FaxAccount;
11 var FaxApplication = require('../../models').FaxApplication;
13 exports.register = function(queue) {
14 FaxRoom.afterCreate(function(doc) {
19 function onSave(queue, doc, cb) {
20 if (doc.status === 'NEW') {
22 .findById(doc.FaxAccountId)
23 .then(function(faxAccount) {
31 attributes: ['id', 'strategy', 'timeout'],
41 .then(function(faxApplications) {
45 accountId: doc.FaxAccountId,
50 applications: faxApplications
53 // Create queue process
54 queue.create('fax', data).save();
56 .catch(function(err) {
60 .catch(function(err) {