Built motion from commit (unavailable).|2.5.23
[motion2.git] / server / api / openchannelMessage / openchannelMessage.model.js
index b53b652..2229c15 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb4fa=['bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','secret','CmContact','describe','find','Interactions','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','Contact','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x31f22e,_0x434db1){var _0x16e1b0=function(_0x4f5355){while(--_0x4f5355){_0x31f22e['push'](_0x31f22e['shift']());}};_0x16e1b0(++_0x434db1);}(_0xb4fa,0x1f0));var _0xab4f=function(_0x2aa891,_0x388317){_0x2aa891=_0x2aa891-0x0;var _0x4380c4=_0xb4fa[_0x2aa891];return _0x4380c4;};'use strict';var _=require(_0xab4f('0x0'));var util=require('util');var logger=require(_0xab4f('0x1'))(_0xab4f('0x2'));var moment=require(_0xab4f('0x3'));var BPromise=require(_0xab4f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab4f('0x5'));var rimraf=require(_0xab4f('0x6'));var config=require(_0xab4f('0x7'));var attributes=require(_0xab4f('0x8'));module[_0xab4f('0x9')]=function(_0x23ed14,_0x505e82){return _0x23ed14[_0xab4f('0xa')]('OpenchannelMessage',attributes,{'tableName':_0xab4f('0xb'),'paranoid':![],'indexes':[{'name':_0xab4f('0xc'),'fields':[_0xab4f('0xd')],'type':_0xab4f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b61fd,_0x364fd9,_0x5abcda){var _0x32cabe=_0x23ed14['models'];var _0x23b5ea=_0x4b61fd[_0xab4f('0xf')]({'plain':!![]});if(_0x23b5ea[_0xab4f('0x10')][_0xab4f('0x11')]()==='in'||_0x23b5ea['direction'][_0xab4f('0x11')]()===_0xab4f('0x12')&&!_0x23b5ea['secret']&&!_['isNil'](_0x23b5ea['UserId'])){_0x32cabe[_0xab4f('0x13')]['findOne']({'where':{'id':_0x23b5ea[_0xab4f('0x14')]}})[_0xab4f('0x15')](function(_0x45dda5){if(_0x45dda5){_0x45dda5[_0xab4f('0x16')]({'lastMsgAt':_0x23b5ea[_0xab4f('0x17')],'lastMsgDirection':_0x23b5ea['direction'][_0xab4f('0x11')]()});}})[_0xab4f('0x18')](function(_0x17e7f7){console[_0xab4f('0x19')](_0x17e7f7);});}if(_0x23b5ea[_0xab4f('0x10')]==='out'&&!_0x23b5ea[_0xab4f('0x1a')]){var _0x54d0ff;_0x32cabe[_0xab4f('0x1b')][_0xab4f('0x1c')]()[_0xab4f('0x15')](function(_0x47860c){return _0x32cabe['OpenchannelAccount'][_0xab4f('0x1d')]({'where':{'id':_0x23b5ea['OpenchannelAccountId']},'include':[{'model':_0x32cabe[_0xab4f('0x13')],'as':_0xab4f('0x1e'),'where':{'id':_0x23b5ea[_0xab4f('0x14')]},'limit':0x1,'include':[{'model':_0x32cabe[_0xab4f('0x1b')],'as':'Contact','attributes':_[_0xab4f('0x1f')](_0x47860c)}]}]});})[_0xab4f('0x15')](function(_0x2a1348){_0x54d0ff=_0x2a1348[_0xab4f('0xf')]({'plain':!![]});if(_0x54d0ff&&_0x54d0ff[_0xab4f('0x20')]){logger[_0xab4f('0x21')](_0xab4f('0x22'),_0xab4f('0x23'),util[_0xab4f('0x24')](_0xab4f('0x25'),_0x23b5ea['id'],_0x54d0ff['replyUri']));if(_0x54d0ff[_0xab4f('0x1e')]&&_0x54d0ff['Interactions'][_0xab4f('0x26')]){_0x23b5ea['Interaction']=_[_0xab4f('0x27')](_0x54d0ff['Interactions'][0x0],_0xab4f('0x28'));_0x23b5ea['Contact']=_0x54d0ff['Interactions'][0x0]['Contact'];}var _0x364fd9={'method':_0xab4f('0x29'),'uri':encodeURI(_0x54d0ff[_0xab4f('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x364fd9[_0xab4f('0x2a')]){case'GET':_0x364fd9['qs']=_0x23b5ea;break;case _0xab4f('0x29'):_0x364fd9['body']=_0x23b5ea;break;}return rp(_0x364fd9)[_0xab4f('0x15')](function(_0x3e1574){logger[_0xab4f('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0xab4f('0x23'),util[_0xab4f('0x24')](_0xab4f('0x2b'),_0x23b5ea['id'],_0x54d0ff['replyUri']));if(_0x3e1574['body']['threadId']&&_0x3e1574[_0xab4f('0xd')][_0xab4f('0x2c')]!=_0x23b5ea[_0xab4f('0x2d')][_0xab4f('0x2c')]){return _0x32cabe[_0xab4f('0x13')][_0xab4f('0x16')]({'threadId':_0x3e1574['body'][_0xab4f('0x2c')]},{'logging':!![],'where':{'id':_0x23b5ea['Interaction']['id']}});}else{return;}})[_0xab4f('0x15')](function(){return _0x4b61fd[_0xab4f('0x16')]({'read':!![]});})['catch'](function(_0x128815){logger['error'](_0xab4f('0x22'),_0xab4f('0x23'),util[_0xab4f('0x2e')](_0x128815,{'showHidden':![],'depth':null}));_0x5abcda();});}else{_0x5abcda();}})[_0xab4f('0x2f')](function(){_0x5abcda();});}else{_0x5abcda();}}},'charset':_0xab4f('0x30'),'collate':_0xab4f('0x31')});};
\ No newline at end of file
+var _0xedbf=['describe','OpenchannelAccount','Interactions','Contact','keys','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','method','GET','POST','info','afterCreate','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','out','secret'];(function(_0x3237a6,_0x288106){var _0x3447fc=function(_0x510480){while(--_0x510480){_0x3237a6['push'](_0x3237a6['shift']());}};_0x3447fc(++_0x288106);}(_0xedbf,0x6f));var _0xfedb=function(_0x244ddb,_0x107a6c){_0x244ddb=_0x244ddb-0x0;var _0x2aa596=_0xedbf[_0x244ddb];return _0x2aa596;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfedb('0x0'))(_0xfedb('0x1'));var moment=require('moment');var BPromise=require(_0xfedb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfedb('0x3'));var config=require(_0xfedb('0x4'));var attributes=require('./openchannelMessage.attributes');module[_0xfedb('0x5')]=function(_0x2304df,_0x573dff){return _0x2304df[_0xfedb('0x6')]('OpenchannelMessage',attributes,{'tableName':_0xfedb('0x7'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xfedb('0x8')],'type':_0xfedb('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41336b,_0x227165,_0x53cfd1){var _0x429f38=_0x2304df[_0xfedb('0xa')];var _0x58fd38=_0x41336b[_0xfedb('0xb')]({'plain':!![]});if(_0x58fd38[_0xfedb('0xc')]['toLowerCase']()==='in'||_0x58fd38[_0xfedb('0xc')][_0xfedb('0xd')]()==='out'&&!_0x58fd38['secret']&&!_['isNil'](_0x58fd38[_0xfedb('0xe')])){_0x429f38['OpenchannelInteraction'][_0xfedb('0xf')]({'where':{'id':_0x58fd38[_0xfedb('0x10')]}})[_0xfedb('0x11')](function(_0x427b18){if(_0x427b18){_0x427b18[_0xfedb('0x12')]({'lastMsgAt':_0x58fd38[_0xfedb('0x13')],'lastMsgDirection':_0x58fd38[_0xfedb('0xc')][_0xfedb('0xd')]()});}})[_0xfedb('0x14')](function(_0xc4fa5b){console[_0xfedb('0x15')](_0xc4fa5b);});}if(_0x58fd38['direction']===_0xfedb('0x16')&&!_0x58fd38[_0xfedb('0x17')]){var _0x124c68;_0x429f38['CmContact'][_0xfedb('0x18')]()['then'](function(_0x3f7896){return _0x429f38[_0xfedb('0x19')]['find']({'where':{'id':_0x58fd38['OpenchannelAccountId']},'include':[{'model':_0x429f38['OpenchannelInteraction'],'as':_0xfedb('0x1a'),'where':{'id':_0x58fd38[_0xfedb('0x10')]},'limit':0x1,'include':[{'model':_0x429f38['CmContact'],'as':_0xfedb('0x1b'),'attributes':_[_0xfedb('0x1c')](_0x3f7896)}]}]});})[_0xfedb('0x11')](function(_0x5b9ea6){_0x124c68=_0x5b9ea6[_0xfedb('0xb')]({'plain':!![]});if(_0x124c68&&_0x124c68['replyUri']){logger['info'](_0xfedb('0x1d'),'afterCreate',util['format'](_0xfedb('0x1e'),_0x58fd38['id'],_0x124c68[_0xfedb('0x1f')]));if(_0x124c68[_0xfedb('0x1a')]&&_0x124c68[_0xfedb('0x1a')][_0xfedb('0x20')]){_0x58fd38[_0xfedb('0x21')]=_[_0xfedb('0x22')](_0x124c68[_0xfedb('0x1a')][0x0],_0xfedb('0x1b'));_0x58fd38['Contact']=_0x124c68[_0xfedb('0x1a')][0x0][_0xfedb('0x1b')];}var _0x227165={'method':'POST','uri':encodeURI(_0x124c68[_0xfedb('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x227165[_0xfedb('0x23')]){case _0xfedb('0x24'):_0x227165['qs']=_0x58fd38;break;case _0xfedb('0x25'):_0x227165[_0xfedb('0x8')]=_0x58fd38;break;}return rp(_0x227165)[_0xfedb('0x11')](function(_0x93c759){logger[_0xfedb('0x26')](_0xfedb('0x1d'),_0xfedb('0x27'),util[_0xfedb('0x28')](_0xfedb('0x29'),_0x58fd38['id'],_0x124c68[_0xfedb('0x1f')]));if(_0x93c759['body'][_0xfedb('0x2a')]&&_0x93c759['body'][_0xfedb('0x2a')]!=_0x58fd38[_0xfedb('0x21')][_0xfedb('0x2a')]){return _0x429f38['OpenchannelInteraction']['update']({'threadId':_0x93c759[_0xfedb('0x8')]['threadId']},{'logging':!![],'where':{'id':_0x58fd38[_0xfedb('0x21')]['id']}});}else{return;}})[_0xfedb('0x11')](function(){return _0x41336b[_0xfedb('0x12')]({'read':!![]});})[_0xfedb('0x14')](function(_0x34e740){logger[_0xfedb('0x15')](_0xfedb('0x1d'),_0xfedb('0x27'),util['inspect'](_0x34e740,{'showHidden':![],'depth':null}));_0x53cfd1();});}else{_0x53cfd1();}})['finally'](function(){_0x53cfd1();});}else{_0x53cfd1();}}},'charset':_0xfedb('0x2b'),'collate':_0xfedb('0x2c')});};
\ No newline at end of file