Built motion from commit (unavailable).|2.5.19
[motion2.git] / server / api / whatsappMessage / whatsappMessage.model.js
index b71794b..930a11e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f39=['whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','catch','error','out','WhatsappAccount','find','type','twilio','accountSid','phone','authToken','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','WhatsappMessage'];(function(_0x3cbd23,_0x331219){var _0x58141b=function(_0x458e98){while(--_0x458e98){_0x3cbd23['push'](_0x3cbd23['shift']());}};_0x58141b(++_0x331219);}(_0x8f39,0xea));var _0x98f3=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x8f39[_0x599e60];return _0x468e19;};'use strict';var _=require(_0x98f3('0x0'));var util=require(_0x98f3('0x1'));var logger=require(_0x98f3('0x2'))(_0x98f3('0x3'));var moment=require(_0x98f3('0x4'));var BPromise=require('bluebird');var rp=require(_0x98f3('0x5'));var fs=require('fs');var path=require(_0x98f3('0x6'));var rimraf=require('rimraf');var config=require(_0x98f3('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x98f3('0x8')]=function(_0x264e6e,_0x224201){return _0x264e6e[_0x98f3('0x9')](_0x98f3('0xa'),attributes,{'tableName':_0x98f3('0xb'),'paranoid':![],'indexes':[{'name':_0x98f3('0xc'),'fields':[_0x98f3('0xc')]},{'name':_0x98f3('0xd'),'fields':[_0x98f3('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf7705e,_0x59a052,_0x1a0af5){var _0x5b8adc=_0x264e6e[_0x98f3('0xf')];var _0x27525a=_0xf7705e[_0x98f3('0x10')]({'plain':!![]});if(_0x27525a[_0x98f3('0x11')][_0x98f3('0x12')]()==='in'||_0x27525a[_0x98f3('0x11')][_0x98f3('0x12')]()==='out'&&!_0x27525a[_0x98f3('0x13')]&&!_[_0x98f3('0x14')](_0x27525a[_0x98f3('0x15')])){_0x5b8adc[_0x98f3('0x16')]['findOne']({'where':{'id':_0x27525a[_0x98f3('0x17')]}})[_0x98f3('0x18')](function(_0xa3c377){if(_0xa3c377){_0xa3c377[_0x98f3('0x19')]({'lastMsgAt':_0x27525a[_0x98f3('0x1a')],'lastMsgDirection':_0x27525a[_0x98f3('0x11')][_0x98f3('0x12')]()});}})[_0x98f3('0x1b')](function(_0x4150e6){console[_0x98f3('0x1c')](_0x4150e6);});}if(_0x27525a[_0x98f3('0x11')]===_0x98f3('0x1d')&&!_0x27525a[_0x98f3('0x13')]){var _0x44138d;_0x5b8adc[_0x98f3('0x1e')][_0x98f3('0x1f')]({'where':{'id':_0x27525a['WhatsappAccountId']},'raw':!![]})[_0x98f3('0x18')](function(_0x48513d){_0x44138d=_0x48513d;if(_0x44138d&&_0x44138d[_0x98f3('0x20')]){switch(_0x44138d[_0x98f3('0x20')]){case _0x98f3('0x21'):var _0x268090=require(_0x98f3('0x21'));if(_0x44138d[_0x98f3('0x22')]&&_0x44138d['authToken']&&_0x44138d[_0x98f3('0x23')]){var _0x9575c=new _0x268090(_0x44138d[_0x98f3('0x22')],_0x44138d[_0x98f3('0x24')]);_0x9575c['messages'][_0x98f3('0x25')]({'body':_0x27525a[_0x98f3('0xe')],'to':_0x98f3('0x26')+_0x27525a[_0x98f3('0x23')],'from':_0x98f3('0x26')+_0x44138d[_0x98f3('0x23')],'statusCallback':_0x44138d[_0x98f3('0x27')]+_0x98f3('0x28')+_0x27525a['id']+'/status?token='+_0x44138d[_0x98f3('0x29')]})[_0x98f3('0x18')](function(_0x541c8d){if(_0x541c8d[_0x98f3('0x2a')]){return _0xf7705e[_0x98f3('0x19')]({'messageId':_0x541c8d[_0x98f3('0x2a')]});}})[_0x98f3('0x1b')](function(_0x937d8d){logger[_0x98f3('0x1c')](_0x98f3('0x2b'),_0x98f3('0x2c'),_0x98f3('0x21'),util[_0x98f3('0x2d')](_0x937d8d,{'showHidden':![],'depth':null}));});}else{logger[_0x98f3('0x1c')](_0x98f3('0x2b'),_0x98f3('0x2c'),_0x98f3('0x21'),_0x98f3('0x2e'));}break;}}})[_0x98f3('0x2f')](function(){_0x1a0af5();});}else{_0x1a0af5();}}},'charset':'utf8mb4','collate':_0x98f3('0x30')});};
\ No newline at end of file
+var _0xa11b=['error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','createdAt','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','sid','catch'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa11b,0x92));var _0xba11=function(_0x2d63f2,_0x4b5439){_0x2d63f2=_0x2d63f2-0x0;var _0x20d49a=_0xa11b[_0x2d63f2];return _0x20d49a;};'use strict';var _=require('lodash');var util=require(_0xba11('0x0'));var logger=require(_0xba11('0x1'))(_0xba11('0x2'));var moment=require(_0xba11('0x3'));var BPromise=require(_0xba11('0x4'));var rp=require(_0xba11('0x5'));var fs=require('fs');var path=require(_0xba11('0x6'));var rimraf=require('rimraf');var config=require(_0xba11('0x7'));var attributes=require(_0xba11('0x8'));module[_0xba11('0x9')]=function(_0xf52d07,_0xc372f5){return _0xf52d07[_0xba11('0xa')](_0xba11('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xba11('0xc'),'fields':[_0xba11('0xc')]},{'name':_0xba11('0xd'),'fields':[_0xba11('0xe')],'type':_0xba11('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb7ffa2,_0x1a6ee2,_0x2c62ba){var _0x5e1b8a=_0xf52d07[_0xba11('0x10')];var _0x5a7a30=_0xb7ffa2[_0xba11('0x11')]({'plain':!![]});if(_0x5a7a30[_0xba11('0x12')][_0xba11('0x13')]()==='in'||_0x5a7a30['direction'][_0xba11('0x13')]()===_0xba11('0x14')&&!_0x5a7a30[_0xba11('0x15')]&&!_[_0xba11('0x16')](_0x5a7a30[_0xba11('0x17')])){_0x5e1b8a[_0xba11('0x18')][_0xba11('0x19')]({'where':{'id':_0x5a7a30['WhatsappInteractionId']}})[_0xba11('0x1a')](function(_0x1a891e){if(_0x1a891e){_0x1a891e['update']({'lastMsgAt':_0x5a7a30[_0xba11('0x1b')],'lastMsgDirection':_0x5a7a30[_0xba11('0x12')][_0xba11('0x13')]()});}})['catch'](function(_0x3bd810){console['error'](_0x3bd810);});}if(_0x5a7a30['direction']===_0xba11('0x14')&&!_0x5a7a30[_0xba11('0x15')]){var _0xb698e3;_0x5e1b8a['WhatsappAccount'][_0xba11('0x1c')]({'where':{'id':_0x5a7a30[_0xba11('0x1d')]},'raw':!![]})[_0xba11('0x1a')](function(_0x2cce6e){_0xb698e3=_0x2cce6e;if(_0xb698e3&&_0xb698e3[_0xba11('0x1e')]){switch(_0xb698e3[_0xba11('0x1e')]){case _0xba11('0x1f'):var _0x37f7bd=require(_0xba11('0x1f'));if(_0xb698e3[_0xba11('0x20')]&&_0xb698e3[_0xba11('0x21')]&&_0xb698e3['phone']){var _0x3759be=new _0x37f7bd(_0xb698e3[_0xba11('0x20')],_0xb698e3[_0xba11('0x21')]);_0x3759be[_0xba11('0x22')][_0xba11('0x23')]({'body':_0x5a7a30['body'],'to':_0xba11('0x24')+_0x5a7a30[_0xba11('0x25')],'from':_0xba11('0x24')+_0xb698e3[_0xba11('0x25')],'statusCallback':_0xb698e3[_0xba11('0x26')]+_0xba11('0x27')+_0x5a7a30['id']+'/status?token='+_0xb698e3['token']})['then'](function(_0x1608af){if(_0x1608af[_0xba11('0x28')]){return _0xb7ffa2['update']({'messageId':_0x1608af[_0xba11('0x28')]});}})[_0xba11('0x29')](function(_0x300d35){logger[_0xba11('0x2a')](_0xba11('0x2b'),_0xba11('0x2c'),'twilio',util[_0xba11('0x2d')](_0x300d35,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xba11('0x2b'),_0xba11('0x2c'),_0xba11('0x1f'),_0xba11('0x2e'));}break;}}})['finally'](function(){_0x2c62ba();});}else{_0x2c62ba();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file