Built motion from commit da24aabd.|2.6.20
[motion2.git] / server / api / openchannelMessage / openchannelMessage.model.js
index 8f39ab8..0709346 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc46b=['info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','Interaction','omit','Contact','replyUri','GET','POST','body','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','secret','CmContact','OpenchannelAccount','find','OpenchannelAccountId','keys'];(function(_0x1aeb29,_0x245cfd){var _0x27b597=function(_0x2fbdea){while(--_0x2fbdea){_0x1aeb29['push'](_0x1aeb29['shift']());}};_0x27b597(++_0x245cfd);}(_0xc46b,0x7a));var _0xbc46=function(_0x45c1ca,_0x683fea){_0x45c1ca=_0x45c1ca-0x0;var _0x131c82=_0xc46b[_0x45c1ca];return _0x131c82;};'use strict';var _=require(_0xbc46('0x0'));var util=require(_0xbc46('0x1'));var logger=require(_0xbc46('0x2'))(_0xbc46('0x3'));var moment=require(_0xbc46('0x4'));var BPromise=require(_0xbc46('0x5'));var rp=require(_0xbc46('0x6'));var fs=require('fs');var path=require(_0xbc46('0x7'));var rimraf=require(_0xbc46('0x8'));var config=require(_0xbc46('0x9'));var attributes=require(_0xbc46('0xa'));module['exports']=function(_0x34d771,_0x137b04){return _0x34d771[_0xbc46('0xb')](_0xbc46('0xc'),attributes,{'tableName':_0xbc46('0xd'),'paranoid':![],'indexes':[{'name':_0xbc46('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f96d9,_0x4f4a60,_0x437244){var _0x32b05b=_0x34d771[_0xbc46('0xf')];var _0x1887d4=_0x2f96d9[_0xbc46('0x10')]({'plain':!![]});if(_0x1887d4[_0xbc46('0x11')][_0xbc46('0x12')]()==='in'||_0x1887d4[_0xbc46('0x11')][_0xbc46('0x12')]()===_0xbc46('0x13')&&!_0x1887d4['secret']&&!_[_0xbc46('0x14')](_0x1887d4[_0xbc46('0x15')])){_0x32b05b[_0xbc46('0x16')][_0xbc46('0x17')]({'where':{'id':_0x1887d4[_0xbc46('0x18')]}})[_0xbc46('0x19')](function(_0x3c17fc){if(_0x3c17fc){_0x3c17fc[_0xbc46('0x1a')]({'lastMsgAt':_0x1887d4[_0xbc46('0x1b')],'lastMsgDirection':_0x1887d4[_0xbc46('0x11')]['toLowerCase']()});}})['catch'](function(_0x46067f){console['error'](_0x46067f);});}if(_0x1887d4[_0xbc46('0x11')]==='out'&&!_0x1887d4[_0xbc46('0x1c')]){var _0x380d2f;_0x32b05b[_0xbc46('0x1d')]['describe']()[_0xbc46('0x19')](function(_0x5e34fd){return _0x32b05b[_0xbc46('0x1e')][_0xbc46('0x1f')]({'where':{'id':_0x1887d4[_0xbc46('0x20')]},'include':[{'model':_0x32b05b[_0xbc46('0x16')],'as':'Interactions','where':{'id':_0x1887d4[_0xbc46('0x18')]},'limit':0x1,'include':[{'model':_0x32b05b[_0xbc46('0x1d')],'as':'Contact','attributes':_[_0xbc46('0x21')](_0x5e34fd)}]}]});})[_0xbc46('0x19')](function(_0xdef835){_0x380d2f=_0xdef835[_0xbc46('0x10')]({'plain':!![]});if(_0x380d2f&&_0x380d2f['replyUri']){logger[_0xbc46('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0xbc46('0x23'),util[_0xbc46('0x24')](_0xbc46('0x25'),_0x1887d4['id'],_0x380d2f['replyUri']));if(_0x380d2f[_0xbc46('0x26')]&&_0x380d2f[_0xbc46('0x26')]['length']){_0x1887d4[_0xbc46('0x27')]=_[_0xbc46('0x28')](_0x380d2f[_0xbc46('0x26')][0x0],_0xbc46('0x29'));_0x1887d4[_0xbc46('0x29')]=_0x380d2f[_0xbc46('0x26')][0x0][_0xbc46('0x29')];}var _0x4f4a60={'method':'POST','uri':encodeURI(_0x380d2f[_0xbc46('0x2a')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4f4a60['method']){case _0xbc46('0x2b'):_0x4f4a60['qs']=_0x1887d4;break;case _0xbc46('0x2c'):_0x4f4a60[_0xbc46('0x2d')]=_0x1887d4;break;}return rp(_0x4f4a60)['then'](function(_0x3ca047){logger[_0xbc46('0x22')](_0xbc46('0x2e'),_0xbc46('0x23'),util['format'](_0xbc46('0x2f'),_0x1887d4['id'],_0x380d2f[_0xbc46('0x2a')]));if(_0x3ca047['body'][_0xbc46('0x30')]&&_0x3ca047[_0xbc46('0x2d')][_0xbc46('0x30')]!=_0x1887d4[_0xbc46('0x27')]['threadId']){return _0x32b05b[_0xbc46('0x16')][_0xbc46('0x1a')]({'threadId':_0x3ca047['body'][_0xbc46('0x30')]},{'logging':!![],'where':{'id':_0x1887d4[_0xbc46('0x27')]['id']}});}else{return;}})[_0xbc46('0x19')](function(){return _0x2f96d9[_0xbc46('0x1a')]({'read':!![]});})[_0xbc46('0x31')](function(_0x455a8f){logger[_0xbc46('0x32')](_0xbc46('0x2e'),_0xbc46('0x23'),util['inspect'](_0x455a8f,{'showHidden':![],'depth':null}));_0x437244();});}else{_0x437244();}})['finally'](function(){_0x437244();});}else{_0x437244();}}},'charset':'utf8mb4','collate':_0xbc46('0x33')});};
\ No newline at end of file
+var _0x7f46=['POST','method','GET','body','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','omit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7f46,0x170));var _0x67f4=function(_0x58ee19,_0xdf0765){_0x58ee19=_0x58ee19-0x0;var _0x49af25=_0x7f46[_0x58ee19];return _0x49af25;};'use strict';var _=require(_0x67f4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x67f4('0x1'));var moment=require('moment');var BPromise=require(_0x67f4('0x2'));var rp=require(_0x67f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67f4('0x4'));var config=require(_0x67f4('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0x67f4('0x6')]=function(_0x425076,_0x4b2756){return _0x425076[_0x67f4('0x7')](_0x67f4('0x8'),attributes,{'tableName':_0x67f4('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':_0x67f4('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3146e0,_0x3256c5,_0x252bb8){var _0x5d1271=_0x425076['models'];var _0x2882bb=_0x3146e0[_0x67f4('0xb')]({'plain':!![]});if(_0x2882bb[_0x67f4('0xc')][_0x67f4('0xd')]()==='in'||_0x2882bb[_0x67f4('0xc')][_0x67f4('0xd')]()===_0x67f4('0xe')&&!_0x2882bb[_0x67f4('0xf')]&&!_[_0x67f4('0x10')](_0x2882bb[_0x67f4('0x11')])){_0x5d1271[_0x67f4('0x12')][_0x67f4('0x13')]({'where':{'id':_0x2882bb[_0x67f4('0x14')]}})[_0x67f4('0x15')](function(_0x236fc8){if(_0x236fc8){_0x236fc8[_0x67f4('0x16')]({'lastMsgAt':_0x2882bb[_0x67f4('0x17')],'lastMsgDirection':_0x2882bb[_0x67f4('0xc')][_0x67f4('0xd')]()});}})[_0x67f4('0x18')](function(_0x56b057){console['error'](_0x56b057);});}if(_0x2882bb[_0x67f4('0xc')]===_0x67f4('0xe')&&!_0x2882bb[_0x67f4('0xf')]){var _0x57f6c3;_0x5d1271[_0x67f4('0x19')][_0x67f4('0x1a')]()[_0x67f4('0x15')](function(_0x5e3071){return _0x5d1271[_0x67f4('0x1b')][_0x67f4('0x1c')]({'where':{'id':_0x2882bb[_0x67f4('0x1d')]},'include':[{'model':_0x5d1271[_0x67f4('0x12')],'as':_0x67f4('0x1e'),'where':{'id':_0x2882bb[_0x67f4('0x14')]},'limit':0x1,'include':[{'model':_0x5d1271[_0x67f4('0x19')],'as':_0x67f4('0x1f'),'attributes':_[_0x67f4('0x20')](_0x5e3071)}]}]});})[_0x67f4('0x15')](function(_0xa3741){_0x57f6c3=_0xa3741[_0x67f4('0xb')]({'plain':!![]});if(_0x57f6c3&&_0x57f6c3[_0x67f4('0x21')]){logger['info'](_0x67f4('0x22'),_0x67f4('0x23'),util[_0x67f4('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x2882bb['id'],_0x57f6c3[_0x67f4('0x21')]));if(_0x57f6c3['Interactions']&&_0x57f6c3[_0x67f4('0x1e')][_0x67f4('0x25')]){_0x2882bb[_0x67f4('0x26')]=_[_0x67f4('0x27')](_0x57f6c3[_0x67f4('0x1e')][0x0],_0x67f4('0x1f'));_0x2882bb[_0x67f4('0x1f')]=_0x57f6c3[_0x67f4('0x1e')][0x0][_0x67f4('0x1f')];}var _0x3256c5={'method':_0x67f4('0x28'),'uri':encodeURI(_0x57f6c3[_0x67f4('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3256c5[_0x67f4('0x29')]){case _0x67f4('0x2a'):_0x3256c5['qs']=_0x2882bb;break;case _0x67f4('0x28'):_0x3256c5[_0x67f4('0x2b')]=_0x2882bb;break;}return rp(_0x3256c5)['then'](function(_0x6efb65){logger[_0x67f4('0x2c')](_0x67f4('0x22'),_0x67f4('0x23'),util[_0x67f4('0x24')](_0x67f4('0x2d'),_0x2882bb['id'],_0x57f6c3[_0x67f4('0x21')]));if(_0x6efb65[_0x67f4('0x2b')][_0x67f4('0x2e')]&&_0x6efb65[_0x67f4('0x2b')][_0x67f4('0x2e')]!=_0x2882bb['Interaction']['threadId']){return _0x5d1271[_0x67f4('0x12')][_0x67f4('0x16')]({'threadId':_0x6efb65[_0x67f4('0x2b')][_0x67f4('0x2e')]},{'where':{'id':_0x2882bb[_0x67f4('0x26')]['id']}});}else{return;}})[_0x67f4('0x15')](function(){return _0x3146e0[_0x67f4('0x16')]({'read':!![]});})[_0x67f4('0x18')](function(_0x5242c7){logger[_0x67f4('0x2f')](_0x67f4('0x22'),_0x67f4('0x23'),util[_0x67f4('0x30')](_0x5242c7,{'showHidden':![],'depth':null}));_0x252bb8();});}else{_0x252bb8();}})['finally'](function(){_0x252bb8();});}else{_0x252bb8();}}},'charset':_0x67f4('0x31'),'collate':_0x67f4('0x32')});};
\ No newline at end of file