Built motion from commit ded33658aad58fc8de845a8299a9db59a88cc353. Version 3.0.0...
[motion-next.git] / server / api / openchannelMessage / openchannelMessage.model.js
index 17912ee..91cc413 100644 (file)
@@ -1 +1 @@
-const a489_0x1bf3=['./openchannelMessage.attributes','OpenchannelMessage,\x20%s,\x20%s','omit','out','format','request-promise-native','utf8mb4','define','UserId','openchannel_messages','Interactions','Interaction','fti_openchannel_messages','models','Forwarding\x20message\x20%d\x20to\x20%s','utf8mb4_unicode_ci','direction','OpenchannelAccount','body','createdAt','findOne','replyUri','error','OpenchannelInteraction','FULLTEXT','OpenchannelAccountId','secret','update','CmContact','length','inspect','get','then','api','POST','Contact','afterCreate','method','keys','isNil','exports','GET','catch','info','OpenchannelMessage','finally','toLowerCase','threadId'];(function(_0x26e8f5,_0x1bf384){const _0x377022=function(_0xd976c){while(--_0xd976c){_0x26e8f5['push'](_0x26e8f5['shift']());}};_0x377022(++_0x1bf384);}(a489_0x1bf3,0xd2));const a489_0x3770=function(_0x26e8f5,_0x1bf384){_0x26e8f5=_0x26e8f5-0x0;let _0x377022=a489_0x1bf3[_0x26e8f5];return _0x377022;};const _0xc5ac9b=a489_0x3770;'use strict';const _=require('lodash'),util=require('util'),logger=require('../../config/logger')(_0xc5ac9b('0xf')),rp=require(_0xc5ac9b('0x23')),attributes=require(_0xc5ac9b('0x1e'));module[_0xc5ac9b('0x16')]=function(_0xd976c){const _0x1f9e59=_0xc5ac9b,_0x4bd7d9=_0xd976c[_0x1f9e59('0x2b')],_0x6dbbb9=_0xd976c[_0x1f9e59('0x25')](_0x1f9e59('0x1a'),attributes,{'tableName':_0x1f9e59('0x27'),'paranoid':![],'indexes':[{'name':_0x1f9e59('0x2a'),'fields':[_0x1f9e59('0x0')],'type':_0x1f9e59('0x6')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27548d){const _0x307273=_0x1f9e59,_0x1856b0=_0x27548d[_0x307273('0xd')]({'plain':!![]});(_0x1856b0[_0x307273('0x2e')][_0x307273('0x1c')]()==='in'||_0x1856b0[_0x307273('0x2e')]['toLowerCase']()==='out'&&!_0x1856b0[_0x307273('0x8')]&&!_[_0x307273('0x15')](_0x1856b0[_0x307273('0x26')]))&&_0x4bd7d9[_0x307273('0x5')][_0x307273('0x2')]({'where':{'id':_0x1856b0['OpenchannelInteractionId']}})['then'](function(_0x26f1da){const _0x1e58ec=_0x307273;_0x26f1da&&_0x26f1da[_0x1e58ec('0x9')]({'lastMsgAt':_0x1856b0[_0x1e58ec('0x1')],'lastMsgDirection':_0x1856b0[_0x1e58ec('0x2e')][_0x1e58ec('0x1c')]()});})[_0x307273('0x18')](function(_0x592cc5){const _0x5b4b4a=_0x307273;console[_0x5b4b4a('0x4')](_0x592cc5);});if(_0x1856b0[_0x307273('0x2e')]===_0x307273('0x21')&&!_0x1856b0['secret']){let _0x8a43c5;_0x4bd7d9[_0x307273('0xa')]['describe']()[_0x307273('0xe')](function(_0x5a181b){const _0x1cdd24=_0x307273;return _0x4bd7d9[_0x1cdd24('0x2f')][_0x1cdd24('0x2')]({'where':{'id':_0x1856b0[_0x1cdd24('0x7')]},'include':[{'model':_0x4bd7d9[_0x1cdd24('0x5')],'as':_0x1cdd24('0x28'),'where':{'id':_0x1856b0['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x4bd7d9[_0x1cdd24('0xa')],'as':_0x1cdd24('0x11'),'attributes':_[_0x1cdd24('0x14')](_0x5a181b)}]}]});})['then'](function(_0x1e8109){const _0x37031a=_0x307273;_0x8a43c5=_0x1e8109['get']({'plain':!![]});if(_0x8a43c5&&_0x8a43c5[_0x37031a('0x3')]){logger[_0x37031a('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x37031a('0x12'),util[_0x37031a('0x22')](_0x37031a('0x2c'),_0x1856b0['id'],_0x8a43c5[_0x37031a('0x3')]));_0x8a43c5['Interactions']&&_0x8a43c5[_0x37031a('0x28')][_0x37031a('0xb')]&&(_0x1856b0[_0x37031a('0x29')]=_[_0x37031a('0x20')](_0x8a43c5[_0x37031a('0x28')][0x0],'Contact'),_0x1856b0[_0x37031a('0x11')]=_0x8a43c5[_0x37031a('0x28')][0x0][_0x37031a('0x11')]);const _0x23a8ab={'method':'POST','uri':encodeURI(_0x8a43c5[_0x37031a('0x3')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x23a8ab[_0x37031a('0x13')]){case _0x37031a('0x17'):_0x23a8ab['qs']=_0x1856b0;break;case _0x37031a('0x10'):_0x23a8ab[_0x37031a('0x0')]=_0x1856b0;break;}return rp(_0x23a8ab)[_0x37031a('0xe')](function(_0x2c09ae){const _0x1f03cd=_0x37031a;logger[_0x1f03cd('0x19')](_0x1f03cd('0x1f'),'afterCreate',util[_0x1f03cd('0x22')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1856b0['id'],_0x8a43c5[_0x1f03cd('0x3')]));if(_0x2c09ae[_0x1f03cd('0x0')]['threadId']&&_0x2c09ae[_0x1f03cd('0x0')]['threadId']!=_0x1856b0[_0x1f03cd('0x29')]['threadId'])return _0x4bd7d9[_0x1f03cd('0x5')]['update']({'threadId':_0x2c09ae[_0x1f03cd('0x0')][_0x1f03cd('0x1d')]},{'logging':!![],'where':{'id':_0x1856b0[_0x1f03cd('0x29')]['id']}});else return;})[_0x37031a('0xe')](function(){const _0x54d658=_0x37031a;return _0x27548d[_0x54d658('0x9')]({'read':!![]});})[_0x37031a('0x18')](function(_0x371d81){const _0x43287d=_0x37031a;logger[_0x43287d('0x4')](_0x43287d('0x1f'),_0x43287d('0x12'),util[_0x43287d('0xc')](_0x371d81,{'showHidden':![],'depth':null}));});}})[_0x307273('0x1b')](function(){return null;});}else return null;}},'charset':_0x1f9e59('0x24'),'collate':_0x1f9e59('0x2d')});return _0x6dbbb9;};
\ No newline at end of file
+const a489_0xabc8=['out','info','CmContact','replyUri','request-promise-native','inspect','OpenchannelMessage','Interaction','OpenchannelInteraction','openchannel_messages','then','createdAt','GET','finally','api','OpenchannelInteractionId','body','utf8mb4','fti_openchannel_messages','OpenchannelMessage,\x20%s,\x20%s','./openchannelMessage.attributes','OpenchannelAccount','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','toLowerCase','POST','exports','threadId','Contact','format','UserId','findOne','update','define','secret','catch','FULLTEXT','direction','OpenchannelAccountId','get','keys','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','describe'];(function(_0x1d4e25,_0xabc850){const _0x1f6209=function(_0x495012){while(--_0x495012){_0x1d4e25['push'](_0x1d4e25['shift']());}};_0x1f6209(++_0xabc850);}(a489_0xabc8,0x198));const a489_0x1f62=function(_0x1d4e25,_0xabc850){_0x1d4e25=_0x1d4e25-0x0;let _0x1f6209=a489_0xabc8[_0x1d4e25];return _0x1f6209;};const _0x18f69f=a489_0x1f62;'use strict';const _=require('lodash'),util=require('util'),logger=require('../../config/logger')(_0x18f69f('0x2')),rp=require(_0x18f69f('0x24')),attributes=require(_0x18f69f('0x8'));module[_0x18f69f('0xe')]=function(_0x495012){const _0x3c9a1b=_0x18f69f,_0x2f438d=_0x495012['models'],_0x1147e2=_0x495012[_0x3c9a1b('0x15')](_0x3c9a1b('0x26'),attributes,{'tableName':_0x3c9a1b('0x29'),'paranoid':![],'indexes':[{'name':_0x3c9a1b('0x6'),'fields':[_0x3c9a1b('0x4')],'type':_0x3c9a1b('0x18')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35e22a){const _0x3db4cf=_0x3c9a1b,_0x21fd3b=_0x35e22a['get']({'plain':!![]});(_0x21fd3b['direction'][_0x3db4cf('0xc')]()==='in'||_0x21fd3b[_0x3db4cf('0x19')][_0x3db4cf('0xc')]()===_0x3db4cf('0x20')&&!_0x21fd3b[_0x3db4cf('0x16')]&&!_['isNil'](_0x21fd3b[_0x3db4cf('0x12')]))&&_0x2f438d[_0x3db4cf('0x28')][_0x3db4cf('0x13')]({'where':{'id':_0x21fd3b[_0x3db4cf('0x3')]}})[_0x3db4cf('0x2a')](function(_0x6c18a3){const _0x9a7bc6=_0x3db4cf;_0x6c18a3&&_0x6c18a3[_0x9a7bc6('0x14')]({'lastMsgAt':_0x21fd3b[_0x9a7bc6('0x2b')],'lastMsgDirection':_0x21fd3b[_0x9a7bc6('0x19')][_0x9a7bc6('0xc')]()});})['catch'](function(_0xcef1c1){console['error'](_0xcef1c1);});if(_0x21fd3b[_0x3db4cf('0x19')]===_0x3db4cf('0x20')&&!_0x21fd3b['secret']){let _0x132e27;_0x2f438d[_0x3db4cf('0x22')][_0x3db4cf('0x1f')]()['then'](function(_0x4f0be0){const _0x2a88f2=_0x3db4cf;return _0x2f438d[_0x2a88f2('0x9')]['findOne']({'where':{'id':_0x21fd3b[_0x2a88f2('0x1a')]},'include':[{'model':_0x2f438d[_0x2a88f2('0x28')],'as':'Interactions','where':{'id':_0x21fd3b[_0x2a88f2('0x3')]},'limit':0x1,'include':[{'model':_0x2f438d['CmContact'],'as':_0x2a88f2('0x10'),'attributes':_[_0x2a88f2('0x1c')](_0x4f0be0)}]}]});})[_0x3db4cf('0x2a')](function(_0x4ca378){const _0x46b7a2=_0x3db4cf;_0x132e27=_0x4ca378[_0x46b7a2('0x1b')]({'plain':!![]});if(_0x132e27&&_0x132e27[_0x46b7a2('0x23')]){logger[_0x46b7a2('0x21')](_0x46b7a2('0x7'),_0x46b7a2('0xa'),util[_0x46b7a2('0x11')](_0x46b7a2('0x1d'),_0x21fd3b['id'],_0x132e27[_0x46b7a2('0x23')]));_0x132e27[_0x46b7a2('0x1e')]&&_0x132e27[_0x46b7a2('0x1e')]['length']&&(_0x21fd3b[_0x46b7a2('0x27')]=_['omit'](_0x132e27[_0x46b7a2('0x1e')][0x0],'Contact'),_0x21fd3b[_0x46b7a2('0x10')]=_0x132e27[_0x46b7a2('0x1e')][0x0][_0x46b7a2('0x10')]);const _0x5424c0={'method':_0x46b7a2('0xd'),'uri':encodeURI(_0x132e27['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5424c0['method']){case _0x46b7a2('0x0'):_0x5424c0['qs']=_0x21fd3b;break;case _0x46b7a2('0xd'):_0x5424c0[_0x46b7a2('0x4')]=_0x21fd3b;break;}return rp(_0x5424c0)[_0x46b7a2('0x2a')](function(_0x5967a5){const _0x4068ac=_0x46b7a2;logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x4068ac('0xa'),util['format'](_0x4068ac('0xb'),_0x21fd3b['id'],_0x132e27[_0x4068ac('0x23')]));if(_0x5967a5[_0x4068ac('0x4')][_0x4068ac('0xf')]&&_0x5967a5[_0x4068ac('0x4')][_0x4068ac('0xf')]!=_0x21fd3b['Interaction'][_0x4068ac('0xf')])return _0x2f438d[_0x4068ac('0x28')][_0x4068ac('0x14')]({'threadId':_0x5967a5[_0x4068ac('0x4')]['threadId']},{'logging':!![],'where':{'id':_0x21fd3b[_0x4068ac('0x27')]['id']}});else return;})[_0x46b7a2('0x2a')](function(){const _0x2d577f=_0x46b7a2;return _0x35e22a[_0x2d577f('0x14')]({'read':!![]});})[_0x46b7a2('0x17')](function(_0x401a80){const _0x57f8c2=_0x46b7a2;logger['error'](_0x57f8c2('0x7'),_0x57f8c2('0xa'),util[_0x57f8c2('0x25')](_0x401a80,{'showHidden':![],'depth':null}));});}})[_0x3db4cf('0x1')](function(){return null;});}else return null;}},'charset':_0x3c9a1b('0x5'),'collate':'utf8mb4_unicode_ci'});return _0x1147e2;};
\ No newline at end of file