Built motion from commit (unavailable).|2.3.10
[motion2.git] / server / api / openchannelMessage / openchannelMessage.model.js
index ccf2338..7268b17 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f41=['omit','Interactions','Contact','replyUri','method','GET','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelInteraction','inspect','finally','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','./openchannelMessage.attributes','exports','define','openchannel_messages','models','direction','toLowerCase','out','UserId','findOne','OpenchannelInteractionId','then','update','body','catch','error','secret','CmContact','describe','find','OpenchannelAccountId','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f41,0x94));var _0x12f4=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x2f41[_0x53abe5];return _0xc1c37e;};'use strict';var _=require(_0x12f4('0x0'));var util=require(_0x12f4('0x1'));var logger=require('../../config/logger')(_0x12f4('0x2'));var moment=require(_0x12f4('0x3'));var BPromise=require('bluebird');var rp=require(_0x12f4('0x4'));var attributes=require(_0x12f4('0x5'));module[_0x12f4('0x6')]=function(_0x44733c,_0x56a07e){return _0x44733c[_0x12f4('0x7')]('OpenchannelMessage',attributes,{'tableName':_0x12f4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x295b3f,_0x32ad05,_0x22ba47){var _0x4282a5=_0x44733c[_0x12f4('0x9')];var _0xb68c92=_0x295b3f['get']({'plain':!![]});if(_0xb68c92[_0x12f4('0xa')][_0x12f4('0xb')]()==='in'||_0xb68c92[_0x12f4('0xa')][_0x12f4('0xb')]()===_0x12f4('0xc')&&!_0xb68c92['secret']&&!_['isNil'](_0xb68c92[_0x12f4('0xd')])){_0x4282a5['OpenchannelInteraction'][_0x12f4('0xe')]({'where':{'id':_0xb68c92[_0x12f4('0xf')]}})[_0x12f4('0x10')](function(_0x15563e){if(_0x15563e){_0x15563e[_0x12f4('0x11')]({'lastMsgAt':_0xb68c92['createdAt'],'lastMsgDirection':_0xb68c92[_0x12f4('0xa')][_0x12f4('0xb')](),'lastMsgBody':_0xb68c92[_0x12f4('0x12')]});}})[_0x12f4('0x13')](function(_0xc8f492){console[_0x12f4('0x14')](_0xc8f492);});}if(_0xb68c92[_0x12f4('0xa')]===_0x12f4('0xc')&&!_0xb68c92[_0x12f4('0x15')]){var _0x1efc20;_0x4282a5[_0x12f4('0x16')][_0x12f4('0x17')]()[_0x12f4('0x10')](function(_0x534f68){return _0x4282a5['OpenchannelAccount'][_0x12f4('0x18')]({'where':{'id':_0xb68c92[_0x12f4('0x19')]},'include':[{'model':_0x4282a5['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0xb68c92[_0x12f4('0xf')]},'limit':0x1,'include':[{'model':_0x4282a5[_0x12f4('0x16')],'as':'Contact','attributes':_['keys'](_0x534f68)}]}]});})[_0x12f4('0x10')](function(_0x4a5bcd){_0x1efc20=_0x4a5bcd['get']({'plain':!![]});if(_0x1efc20&&_0x1efc20['replyUri']){logger[_0x12f4('0x1a')](_0x12f4('0x1b'),_0x12f4('0x1c'),util['format'](_0x12f4('0x1d'),_0xb68c92['id'],_0x1efc20['replyUri']));if(_0x1efc20['Interactions']&&_0x1efc20['Interactions'][_0x12f4('0x1e')]){_0xb68c92[_0x12f4('0x1f')]=_[_0x12f4('0x20')](_0x1efc20[_0x12f4('0x21')][0x0],_0x12f4('0x22'));_0xb68c92[_0x12f4('0x22')]=_0x1efc20[_0x12f4('0x21')][0x0][_0x12f4('0x22')];}var _0x32ad05={'method':'POST','uri':encodeURI(_0x1efc20[_0x12f4('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x32ad05[_0x12f4('0x24')]){case _0x12f4('0x25'):_0x32ad05['qs']=_0xb68c92;break;case'POST':_0x32ad05[_0x12f4('0x12')]=_0xb68c92;break;}return rp(_0x32ad05)[_0x12f4('0x10')](function(_0xb59c9){logger[_0x12f4('0x1a')](_0x12f4('0x1b'),'afterCreate',util[_0x12f4('0x26')](_0x12f4('0x27'),_0xb68c92['id'],_0x1efc20['replyUri']));if(_0xb59c9[_0x12f4('0x12')]['threadId']&&_0xb59c9['body'][_0x12f4('0x28')]!=_0xb68c92[_0x12f4('0x1f')][_0x12f4('0x28')]){return _0x4282a5[_0x12f4('0x29')][_0x12f4('0x11')]({'threadId':_0xb59c9['body']['threadId']},{'logging':!![],'where':{'id':_0xb68c92[_0x12f4('0x1f')]['id']}});}else{return;}})[_0x12f4('0x10')](function(){return _0x295b3f['update']({'read':!![]});})[_0x12f4('0x13')](function(_0x18d1cc){logger[_0x12f4('0x14')](_0x12f4('0x1b'),'afterCreate',util[_0x12f4('0x2a')](_0x18d1cc,{'showHidden':![],'depth':null}));_0x22ba47();});}else{_0x22ba47();}})[_0x12f4('0x2b')](function(){_0x22ba47();});}else{_0x22ba47();}}},'charset':'utf8mb4','collate':_0x12f4('0x2c')});};
\ No newline at end of file
+var _0x5427=['afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','request-promise','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','models','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','body','error','out','secret','CmContact','describe','OpenchannelAccountId','Interactions','Contact','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method'];(function(_0x4f718e,_0x3751fb){var _0x5f1e5f=function(_0x1c0dd5){while(--_0x1c0dd5){_0x4f718e['push'](_0x4f718e['shift']());}};_0x5f1e5f(++_0x3751fb);}(_0x5427,0x1ca));var _0x7542=function(_0x74dcdb,_0x4a1349){_0x74dcdb=_0x74dcdb-0x0;var _0xc58a5=_0x5427[_0x74dcdb];return _0xc58a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7542('0x0'))(_0x7542('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7542('0x2'));var attributes=require(_0x7542('0x3'));module[_0x7542('0x4')]=function(_0x4f2e80,_0x2b0de5){return _0x4f2e80[_0x7542('0x5')](_0x7542('0x6'),attributes,{'tableName':_0x7542('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2d4b56,_0x285fb2,_0x425d1e){var _0x2a358d=_0x4f2e80[_0x7542('0x8')];var _0x4e3d1d=_0x2d4b56['get']({'plain':!![]});if(_0x4e3d1d[_0x7542('0x9')][_0x7542('0xa')]()==='in'||_0x4e3d1d[_0x7542('0x9')]['toLowerCase']()==='out'&&!_0x4e3d1d['secret']&&!_[_0x7542('0xb')](_0x4e3d1d[_0x7542('0xc')])){_0x2a358d[_0x7542('0xd')][_0x7542('0xe')]({'where':{'id':_0x4e3d1d[_0x7542('0xf')]}})[_0x7542('0x10')](function(_0x25947c){if(_0x25947c){_0x25947c[_0x7542('0x11')]({'lastMsgAt':_0x4e3d1d['createdAt'],'lastMsgDirection':_0x4e3d1d['direction'][_0x7542('0xa')](),'lastMsgBody':_0x4e3d1d[_0x7542('0x12')]});}})['catch'](function(_0x67e7bb){console[_0x7542('0x13')](_0x67e7bb);});}if(_0x4e3d1d[_0x7542('0x9')]===_0x7542('0x14')&&!_0x4e3d1d[_0x7542('0x15')]){var _0xcc056c;_0x2a358d[_0x7542('0x16')][_0x7542('0x17')]()[_0x7542('0x10')](function(_0x4b703b){return _0x2a358d['OpenchannelAccount']['find']({'where':{'id':_0x4e3d1d[_0x7542('0x18')]},'include':[{'model':_0x2a358d[_0x7542('0xd')],'as':_0x7542('0x19'),'where':{'id':_0x4e3d1d[_0x7542('0xf')]},'limit':0x1,'include':[{'model':_0x2a358d['CmContact'],'as':_0x7542('0x1a'),'attributes':_['keys'](_0x4b703b)}]}]});})[_0x7542('0x10')](function(_0x2b3a80){_0xcc056c=_0x2b3a80[_0x7542('0x1b')]({'plain':!![]});if(_0xcc056c&&_0xcc056c[_0x7542('0x1c')]){logger[_0x7542('0x1d')](_0x7542('0x1e'),'afterCreate',util[_0x7542('0x1f')](_0x7542('0x20'),_0x4e3d1d['id'],_0xcc056c[_0x7542('0x1c')]));if(_0xcc056c[_0x7542('0x19')]&&_0xcc056c[_0x7542('0x19')][_0x7542('0x21')]){_0x4e3d1d['Interaction']=_[_0x7542('0x22')](_0xcc056c['Interactions'][0x0],'Contact');_0x4e3d1d[_0x7542('0x1a')]=_0xcc056c[_0x7542('0x19')][0x0][_0x7542('0x1a')];}var _0x285fb2={'method':_0x7542('0x23'),'uri':encodeURI(_0xcc056c[_0x7542('0x1c')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x285fb2[_0x7542('0x24')]){case'GET':_0x285fb2['qs']=_0x4e3d1d;break;case _0x7542('0x23'):_0x285fb2[_0x7542('0x12')]=_0x4e3d1d;break;}return rp(_0x285fb2)['then'](function(_0x2ec54a){logger[_0x7542('0x1d')](_0x7542('0x1e'),_0x7542('0x25'),util['format'](_0x7542('0x26'),_0x4e3d1d['id'],_0xcc056c[_0x7542('0x1c')]));if(_0x2ec54a[_0x7542('0x12')][_0x7542('0x27')]&&_0x2ec54a[_0x7542('0x12')]['threadId']!=_0x4e3d1d['Interaction'][_0x7542('0x27')]){return _0x2a358d['OpenchannelInteraction'][_0x7542('0x11')]({'threadId':_0x2ec54a[_0x7542('0x12')][_0x7542('0x27')]},{'logging':!![],'where':{'id':_0x4e3d1d[_0x7542('0x28')]['id']}});}else{return;}})[_0x7542('0x10')](function(){return _0x2d4b56[_0x7542('0x11')]({'read':!![]});})['catch'](function(_0x5cc5fa){logger['error'](_0x7542('0x1e'),_0x7542('0x25'),util[_0x7542('0x29')](_0x5cc5fa,{'showHidden':![],'depth':null}));_0x425d1e();});}else{_0x425d1e();}})[_0x7542('0x2a')](function(){_0x425d1e();});}else{_0x425d1e();}}},'charset':_0x7542('0x2b'),'collate':_0x7542('0x2c')});};
\ No newline at end of file