Built motion from commit b517aaa2a6638133380e4d135c64a80893061362. Version 3.0.0...
[motion-next.git] / server / api / faxInteraction / faxInteraction.events.js
1 const a199_0x15bd=['update','then','save','setDataValue','FaxInteraction','events','catch','FaxMessage','findAll','exports','../../mysqldb','remove','emit','undefined','length','Users','map','unreadMessages'];(function(_0x20894e,_0x15bd8c){const _0x14fb5b=function(_0x12d2b8){while(--_0x12d2b8){_0x20894e['push'](_0x20894e['shift']());}};_0x14fb5b(++_0x15bd8c);}(a199_0x15bd,0xbb));const a199_0x14fb=function(_0x20894e,_0x15bd8c){_0x20894e=_0x20894e-0x0;let _0x14fb5b=a199_0x15bd[_0x20894e];return _0x14fb5b;};const _0x3a744c=a199_0x14fb;'use strict';const EventEmitter=require(_0x3a744c('0x10')),FaxInteraction=require(_0x3a744c('0x3'))['db'][_0x3a744c('0xf')],FaxMessage=require(_0x3a744c('0x3'))['db'][_0x3a744c('0x0')],FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);const events={'afterCreate':_0x3a744c('0xd'),'afterUpdate':_0x3a744c('0xb'),'afterDestroy':_0x3a744c('0x4')};function emitEvent(_0x12d2b8){return function(_0x258846){const _0x4d5797=a199_0x14fb;_0x258846['getUsers']({'attributes':['id'],'raw':!![]})[_0x4d5797('0xc')](function(_0x431558){const _0x1e4096=_0x4d5797;return _0x258846[_0x1e4096('0xe')](_0x1e4096('0x8'),_0x431558[_0x1e4096('0x9')](function(_0x5acf68){return{'id':_0x5acf68['id']};})),FaxMessage[_0x1e4096('0x1')]({'where':{'FaxInteractionId':_0x258846['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4f59f7){const _0x48527a=_0x4d5797;_0x258846[_0x48527a('0xe')](_0x48527a('0xa'),_0x4f59f7[_0x48527a('0x7')]),FaxInteractionEvents['emit'](_0x12d2b8+':'+_0x258846['id'],_0x258846),FaxInteractionEvents[_0x48527a('0x5')](_0x12d2b8,_0x258846);})[_0x4d5797('0x11')](()=>{});};}for(const e in events){if(typeof events[e]!==_0x3a744c('0x6')){const event=events[e];FaxInteraction['addHook'](e,emitEvent(event));}}module[_0x3a744c('0x2')]=FaxInteractionEvents;