4f9fd722c966c99142cabb4747fdd9128dfa4d05
[motion-next.git] / server / api / whatsappInteraction / whatsappInteraction.rpc.js
1 const a797_0x48e8=['findOne','debug','ids','AddTagsToWhatsappInteraction','AddTags','addTags','UpdateWhatsappInteraction','register','omit','info','message','where','attributes','limit','rpc','stringify','body','raw','update','../../rediscache','options','WhatsappInteraction','../../config/logger','then','error'];(function(_0x5c89fe,_0x48e8a0){const _0x453bb3=function(_0x4674ee){while(--_0x4674ee){_0x5c89fe['push'](_0x5c89fe['shift']());}};_0x453bb3(++_0x48e8a0);}(a797_0x48e8,0x155));const a797_0x453b=function(_0x5c89fe,_0x48e8a0){_0x5c89fe=_0x5c89fe-0x0;let _0x453bb3=a797_0x48e8[_0x5c89fe];return _0x453bb3;};const _0x57a94a=a797_0x453b;'use strict';const _=require('lodash'),db=require('../../mysqldb')['db'],logger=require(_0x57a94a('0x6'))(_0x57a94a('0x17')),{getSocket}=require(_0x57a94a('0x3')),socket=getSocket();require('./whatsappInteraction.socket')[_0x57a94a('0x10')](socket),exports[_0x57a94a('0xf')]=function(_0x4674ee){const _0x1a6573=this;return new Promise(function(_0x2e7567,_0x349a3b){const _0x68b7ed=a797_0x453b;return db['WhatsappInteraction'][_0x68b7ed('0x2')](_0x4674ee[_0x68b7ed('0x0')],{'raw':_0x4674ee[_0x68b7ed('0x4')]?_0x4674ee[_0x68b7ed('0x4')][_0x68b7ed('0x1')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4674ee[_0x68b7ed('0x4')]?_0x4674ee[_0x68b7ed('0x4')][_0x68b7ed('0x14')]||null:null,'attributes':_0x4674ee[_0x68b7ed('0x4')]?_0x4674ee[_0x68b7ed('0x4')][_0x68b7ed('0x15')]||null:null,'limit':_0x4674ee['options']?_0x4674ee['options'][_0x68b7ed('0x16')]||null:null})[_0x68b7ed('0x7')](function(_0x1116e4){const _0x221c96=_0x68b7ed;logger[_0x221c96('0x12')](_0x221c96('0xf'),_0x4674ee),logger[_0x221c96('0xa')](_0x221c96('0xf'),_0x4674ee,JSON[_0x221c96('0x18')](_0x1116e4)),_0x2e7567(_0x1116e4);})['catch'](function(_0x11422d){const _0x5edbc2=_0x68b7ed;logger[_0x5edbc2('0x8')](_0x5edbc2('0xf'),_0x11422d[_0x5edbc2('0x13')],_0x4674ee),_0x349a3b(_0x1a6573[_0x5edbc2('0x8')](0x1f4,_0x11422d['message']));});});},exports[_0x57a94a('0xc')]=function(_0x1c1743){const _0x4a61fd=this;return new Promise(function(_0x23bbb5,_0x5f1a58){const _0x1a94f3=a797_0x453b;return db[_0x1a94f3('0x5')][_0x1a94f3('0x9')]({'where':_0x1c1743[_0x1a94f3('0x4')]?_0x1c1743[_0x1a94f3('0x4')][_0x1a94f3('0x14')]||null:null})[_0x1a94f3('0x7')](function(_0x3f9649){const _0x20d353=_0x1a94f3;if(_0x3f9649)return _0x3f9649[_0x20d353('0xe')](_0x1c1743[_0x20d353('0x0')][_0x20d353('0xb')],{'through':_[_0x20d353('0x11')](_0x1c1743[_0x20d353('0x0')],[_0x20d353('0xb'),'id'])});})[_0x1a94f3('0x7')](function([_0xba74b2]){const _0x44382a=_0x1a94f3;logger[_0x44382a('0x12')](_0x44382a('0xd'),_0x1c1743),logger[_0x44382a('0xa')](_0x44382a('0xd'),_0x1c1743,JSON[_0x44382a('0x18')](_0xba74b2)),_0x23bbb5(_0xba74b2);})['catch'](function(_0xf98f66){const _0x2ef2ef=_0x1a94f3;logger[_0x2ef2ef('0x8')](_0x2ef2ef('0xd'),_0xf98f66[_0x2ef2ef('0x13')],_0x1c1743),_0x5f1a58(_0x4a61fd['error'](0x1f4,_0xf98f66[_0x2ef2ef('0x13')]));});});};