Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / openchannelMessage / openchannelMessage.model.js
index 383ffcb..c74bdbb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x96f1=['openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','CmContact','describe','then','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method','GET','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','lodash','util','request-promise','path','rimraf','./openchannelMessage.attributes','exports'];(function(_0x3d8240,_0x2663d4){var _0x3d0372=function(_0xc47c6b){while(--_0xc47c6b){_0x3d8240['push'](_0x3d8240['shift']());}};_0x3d0372(++_0x2663d4);}(_0x96f1,0x171));var _0x196f=function(_0xfd322a,_0x377fb1){_0xfd322a=_0xfd322a-0x0;var _0x3a79da=_0x96f1[_0xfd322a];return _0x3a79da;};'use strict';var _=require(_0x196f('0x0'));var util=require(_0x196f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x196f('0x2'));var fs=require('fs');var path=require(_0x196f('0x3'));var rimraf=require(_0x196f('0x4'));var config=require('../../config/environment');var attributes=require(_0x196f('0x5'));module[_0x196f('0x6')]=function(_0x35cff5,_0x17f007){return _0x35cff5['define']('OpenchannelMessage',attributes,{'tableName':_0x196f('0x7'),'paranoid':![],'indexes':[{'name':_0x196f('0x8'),'fields':[_0x196f('0x9')],'type':_0x196f('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x567c92,_0x14ecd5,_0x33217d){var _0x1bd56e=_0x35cff5[_0x196f('0xb')];var _0x5a4b0c=_0x567c92[_0x196f('0xc')]({'plain':!![]});if(_0x5a4b0c[_0x196f('0xd')][_0x196f('0xe')]()==='in'||_0x5a4b0c[_0x196f('0xd')][_0x196f('0xe')]()===_0x196f('0xf')&&!_0x5a4b0c[_0x196f('0x10')]&&!_[_0x196f('0x11')](_0x5a4b0c[_0x196f('0x12')])){_0x1bd56e[_0x196f('0x13')][_0x196f('0x14')]({'where':{'id':_0x5a4b0c[_0x196f('0x15')]}})['then'](function(_0xc952c1){if(_0xc952c1){_0xc952c1[_0x196f('0x16')]({'lastMsgAt':_0x5a4b0c[_0x196f('0x17')],'lastMsgDirection':_0x5a4b0c[_0x196f('0xd')][_0x196f('0xe')]()});}})['catch'](function(_0x23c387){console['error'](_0x23c387);});}if(_0x5a4b0c[_0x196f('0xd')]===_0x196f('0xf')&&!_0x5a4b0c[_0x196f('0x10')]){var _0x280b88;_0x1bd56e[_0x196f('0x18')][_0x196f('0x19')]()[_0x196f('0x1a')](function(_0x1a958f){return _0x1bd56e['OpenchannelAccount'][_0x196f('0x1b')]({'where':{'id':_0x5a4b0c[_0x196f('0x1c')]},'include':[{'model':_0x1bd56e[_0x196f('0x13')],'as':_0x196f('0x1d'),'where':{'id':_0x5a4b0c[_0x196f('0x15')]},'limit':0x1,'include':[{'model':_0x1bd56e[_0x196f('0x18')],'as':_0x196f('0x1e'),'attributes':_[_0x196f('0x1f')](_0x1a958f)}]}]});})[_0x196f('0x1a')](function(_0x491db0){_0x280b88=_0x491db0[_0x196f('0xc')]({'plain':!![]});if(_0x280b88&&_0x280b88[_0x196f('0x20')]){logger[_0x196f('0x21')](_0x196f('0x22'),_0x196f('0x23'),util['format'](_0x196f('0x24'),_0x5a4b0c['id'],_0x280b88[_0x196f('0x20')]));if(_0x280b88[_0x196f('0x1d')]&&_0x280b88[_0x196f('0x1d')][_0x196f('0x25')]){_0x5a4b0c['Interaction']=_[_0x196f('0x26')](_0x280b88['Interactions'][0x0],_0x196f('0x1e'));_0x5a4b0c[_0x196f('0x1e')]=_0x280b88[_0x196f('0x1d')][0x0][_0x196f('0x1e')];}var _0x14ecd5={'method':_0x196f('0x27'),'uri':encodeURI(_0x280b88['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x14ecd5[_0x196f('0x28')]){case _0x196f('0x29'):_0x14ecd5['qs']=_0x5a4b0c;break;case _0x196f('0x27'):_0x14ecd5[_0x196f('0x9')]=_0x5a4b0c;break;}return rp(_0x14ecd5)['then'](function(_0x14a0d0){logger[_0x196f('0x21')](_0x196f('0x22'),_0x196f('0x23'),util[_0x196f('0x2a')](_0x196f('0x2b'),_0x5a4b0c['id'],_0x280b88[_0x196f('0x20')]));if(_0x14a0d0[_0x196f('0x9')]['threadId']&&_0x14a0d0[_0x196f('0x9')][_0x196f('0x2c')]!=_0x5a4b0c['Interaction']['threadId']){return _0x1bd56e[_0x196f('0x13')][_0x196f('0x16')]({'threadId':_0x14a0d0[_0x196f('0x9')]['threadId']},{'logging':!![],'where':{'id':_0x5a4b0c[_0x196f('0x2d')]['id']}});}else{return;}})[_0x196f('0x1a')](function(){return _0x567c92['update']({'read':!![]});})['catch'](function(_0x2177fd){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x196f('0x23'),util[_0x196f('0x2e')](_0x2177fd,{'showHidden':![],'depth':null}));_0x33217d();});}else{_0x33217d();}})['finally'](function(){_0x33217d();});}else{_0x33217d();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x6d8f=['openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','findOne','then','update','error','out','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','OpenchannelInteractionId','keys','get','replyUri','info','afterCreate','length','omit','Contact','POST','method','format','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage'];(function(_0x147e62,_0x563ecb){var _0x2b8972=function(_0x4c7301){while(--_0x4c7301){_0x147e62['push'](_0x147e62['shift']());}};_0x2b8972(++_0x563ecb);}(_0x6d8f,0xbd));var _0xf6d8=function(_0x1773c5,_0x52f01b){_0x1773c5=_0x1773c5-0x0;var _0x5d72ed=_0x6d8f[_0x1773c5];return _0x5d72ed;};'use strict';var _=require('lodash');var util=require(_0xf6d8('0x0'));var logger=require(_0xf6d8('0x1'))('api');var moment=require(_0xf6d8('0x2'));var BPromise=require('bluebird');var rp=require(_0xf6d8('0x3'));var fs=require('fs');var path=require(_0xf6d8('0x4'));var rimraf=require(_0xf6d8('0x5'));var config=require(_0xf6d8('0x6'));var attributes=require(_0xf6d8('0x7'));module[_0xf6d8('0x8')]=function(_0x296d19,_0x38ca99){return _0x296d19[_0xf6d8('0x9')](_0xf6d8('0xa'),attributes,{'tableName':_0xf6d8('0xb'),'paranoid':![],'indexes':[{'name':_0xf6d8('0xc'),'fields':[_0xf6d8('0xd')],'type':_0xf6d8('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b4bb2,_0x21b185,_0x12ccde){var _0x43492e=_0x296d19[_0xf6d8('0xf')];var _0x1f99f9=_0x4b4bb2['get']({'plain':!![]});if(_0x1f99f9[_0xf6d8('0x10')][_0xf6d8('0x11')]()==='in'||_0x1f99f9[_0xf6d8('0x10')][_0xf6d8('0x11')]()==='out'&&!_0x1f99f9[_0xf6d8('0x12')]&&!_[_0xf6d8('0x13')](_0x1f99f9['UserId'])){_0x43492e['OpenchannelInteraction'][_0xf6d8('0x14')]({'where':{'id':_0x1f99f9['OpenchannelInteractionId']}})[_0xf6d8('0x15')](function(_0x3572cb){if(_0x3572cb){_0x3572cb[_0xf6d8('0x16')]({'lastMsgAt':_0x1f99f9['createdAt'],'lastMsgDirection':_0x1f99f9[_0xf6d8('0x10')]['toLowerCase']()});}})['catch'](function(_0x331116){console[_0xf6d8('0x17')](_0x331116);});}if(_0x1f99f9['direction']===_0xf6d8('0x18')&&!_0x1f99f9['secret']){var _0x276548;_0x43492e[_0xf6d8('0x19')][_0xf6d8('0x1a')]()[_0xf6d8('0x15')](function(_0x459743){return _0x43492e[_0xf6d8('0x1b')][_0xf6d8('0x1c')]({'where':{'id':_0x1f99f9[_0xf6d8('0x1d')]},'include':[{'model':_0x43492e[_0xf6d8('0x1e')],'as':_0xf6d8('0x1f'),'where':{'id':_0x1f99f9[_0xf6d8('0x20')]},'limit':0x1,'include':[{'model':_0x43492e[_0xf6d8('0x19')],'as':'Contact','attributes':_[_0xf6d8('0x21')](_0x459743)}]}]});})[_0xf6d8('0x15')](function(_0x4b38f1){_0x276548=_0x4b38f1[_0xf6d8('0x22')]({'plain':!![]});if(_0x276548&&_0x276548[_0xf6d8('0x23')]){logger[_0xf6d8('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0xf6d8('0x25'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x1f99f9['id'],_0x276548['replyUri']));if(_0x276548[_0xf6d8('0x1f')]&&_0x276548['Interactions'][_0xf6d8('0x26')]){_0x1f99f9['Interaction']=_[_0xf6d8('0x27')](_0x276548[_0xf6d8('0x1f')][0x0],'Contact');_0x1f99f9[_0xf6d8('0x28')]=_0x276548['Interactions'][0x0][_0xf6d8('0x28')];}var _0x21b185={'method':_0xf6d8('0x29'),'uri':encodeURI(_0x276548[_0xf6d8('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x21b185[_0xf6d8('0x2a')]){case'GET':_0x21b185['qs']=_0x1f99f9;break;case _0xf6d8('0x29'):_0x21b185[_0xf6d8('0xd')]=_0x1f99f9;break;}return rp(_0x21b185)['then'](function(_0x5d7286){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xf6d8('0x25'),util[_0xf6d8('0x2b')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1f99f9['id'],_0x276548['replyUri']));if(_0x5d7286[_0xf6d8('0xd')][_0xf6d8('0x2c')]&&_0x5d7286[_0xf6d8('0xd')][_0xf6d8('0x2c')]!=_0x1f99f9[_0xf6d8('0x2d')][_0xf6d8('0x2c')]){return _0x43492e['OpenchannelInteraction'][_0xf6d8('0x16')]({'threadId':_0x5d7286[_0xf6d8('0xd')][_0xf6d8('0x2c')]},{'logging':!![],'where':{'id':_0x1f99f9[_0xf6d8('0x2d')]['id']}});}else{return;}})[_0xf6d8('0x15')](function(){return _0x4b4bb2[_0xf6d8('0x16')]({'read':!![]});})['catch'](function(_0x5727d8){logger[_0xf6d8('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xf6d8('0x25'),util[_0xf6d8('0x2e')](_0x5727d8,{'showHidden':![],'depth':null}));_0x12ccde();});}else{_0x12ccde();}})[_0xf6d8('0x2f')](function(){_0x12ccde();});}else{_0x12ccde();}}},'charset':_0xf6d8('0x30'),'collate':_0xf6d8('0x31')});};
\ No newline at end of file