Built motion from commit da24aabd.|2.6.20
[motion2.git] / server / api / chatMessage / chatMessage.controller.js
index b4709fa..455a2e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdc3f=['isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','User','email','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','chat-interactions','accept','chat','read','UserId','user','agent','get','ChatInteraction','ChatInteractionId'];(function(_0x176254,_0x4f4306){var _0x3b2728=function(_0x476d0d){while(--_0x476d0d){_0x176254['push'](_0x176254['shift']());}};_0x3b2728(++_0x4f4306);}(_0xdc3f,0xa1));var _0xfdc3=function(_0xa71e1a,_0x45dd9e){_0xa71e1a=_0xa71e1a-0x0;var _0x169868=_0xdc3f[_0xa71e1a];return _0x169868;};'use strict';var emlformat=require(_0xfdc3('0x0'));var rimraf=require(_0xfdc3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdc3('0x2'));var rp=require(_0xfdc3('0x3'));var moment=require(_0xfdc3('0x4'));var BPromise=require(_0xfdc3('0x5'));var Mustache=require(_0xfdc3('0x6'));var util=require(_0xfdc3('0x7'));var path=require(_0xfdc3('0x8'));var sox=require(_0xfdc3('0x9'));var csv=require(_0xfdc3('0xa'));var ejs=require(_0xfdc3('0xb'));var fs=require('fs');var fs_extra=require(_0xfdc3('0xc'));var _=require('lodash');var squel=require(_0xfdc3('0xd'));var crypto=require(_0xfdc3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfdc3('0xf'));var toCsv=require(_0xfdc3('0xa'));var querystring=require(_0xfdc3('0x10'));var Papa=require('papaparse');var Redis=require(_0xfdc3('0x11'));var authService=require(_0xfdc3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfdc3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfdc3('0x14'))(_0xfdc3('0x15'));var utils=require(_0xfdc3('0x16'));var config=require(_0xfdc3('0x17'));var licenseUtil=require(_0xfdc3('0x18'));var db=require(_0xfdc3('0x19'))['db'];config[_0xfdc3('0x1a')]=_[_0xfdc3('0x1b')](config[_0xfdc3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xfdc3('0x1c'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xfdc3('0x1d')][_0xfdc3('0x1e')]({'port':0x232c});var client9002=jayson[_0xfdc3('0x1d')][_0xfdc3('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1b4420,_0x3a97ce,_0x422a9c,_0x14047c){return new BPromise(function(_0x27f389,_0x15ca0e){var _0x26c440=_0x14047c||client;return _0x26c440[_0xfdc3('0x1f')](_0x1b4420,_0x422a9c)[_0xfdc3('0x20')](function(_0x5119a8){logger[_0xfdc3('0x21')](_0xfdc3('0x22'),_0x3a97ce,_0xfdc3('0x23'));logger['debug'](_0xfdc3('0x24'),_0x3a97ce,_0xfdc3('0x23'),JSON[_0xfdc3('0x25')](_0x5119a8));if(_0x5119a8[_0xfdc3('0x26')]){if(_0x5119a8[_0xfdc3('0x26')][_0xfdc3('0x27')]===0x1f4){logger[_0xfdc3('0x26')](_0xfdc3('0x22'),_0x3a97ce,_0x5119a8[_0xfdc3('0x26')][_0xfdc3('0x28')]);return _0x15ca0e(_0x5119a8[_0xfdc3('0x26')][_0xfdc3('0x28')]);}logger[_0xfdc3('0x26')](_0xfdc3('0x22'),_0x3a97ce,_0x5119a8[_0xfdc3('0x26')][_0xfdc3('0x28')]);return _0x27f389(_0x5119a8['error'][_0xfdc3('0x28')]);}else{logger[_0xfdc3('0x21')](_0xfdc3('0x22'),_0x3a97ce,_0xfdc3('0x23'));_0x27f389(_0x5119a8[_0xfdc3('0x29')][_0xfdc3('0x28')]);}})['catch'](function(_0x6caa20){logger[_0xfdc3('0x26')]('ChatMessage,\x20%s,\x20%s',_0x3a97ce,_0x6caa20);_0x15ca0e(_0x6caa20);});});}function respondWithStatusCode(_0xa5070c,_0x58c241){_0x58c241=_0x58c241||0xcc;return function(_0x10804f){if(_0x10804f){return _0xa5070c[_0xfdc3('0x2a')](_0x58c241);}return _0xa5070c[_0xfdc3('0x2b')](_0x58c241)[_0xfdc3('0x2c')]();};}function respondWithResult(_0x3ae40e,_0x1ca52b){_0x1ca52b=_0x1ca52b||0xc8;return function(_0x1c3508){if(_0x1c3508){return _0x3ae40e[_0xfdc3('0x2b')](_0x1ca52b)[_0xfdc3('0x2d')](_0x1c3508);}};}function respondWithFilteredResult(_0x514fe1,_0x44b188){return function(_0x4882bf){if(_0x4882bf){var _0x44ddca=typeof _0x44b188['offset']==='undefined'&&typeof _0x44b188['limit']===_0xfdc3('0x2e');var _0x1122c1=_0x4882bf[_0xfdc3('0x2f')];var _0x2d0843=_0x44ddca?0x0:_0x44b188[_0xfdc3('0x30')];var _0x594673=_0x44ddca?_0x4882bf[_0xfdc3('0x2f')]:_0x44b188[_0xfdc3('0x30')]+_0x44b188['limit'];var _0x4dd2a5;if(_0x594673>=_0x1122c1){_0x594673=_0x1122c1;_0x4dd2a5=0xc8;}else{_0x4dd2a5=0xce;}_0x514fe1[_0xfdc3('0x2b')](_0x4dd2a5);return _0x514fe1[_0xfdc3('0x31')]('Content-Range',_0x2d0843+'-'+_0x594673+'/'+_0x1122c1)[_0xfdc3('0x2d')](_0x4882bf);}return null;};}function patchUpdates(_0x5da869){return function(_0x352499){try{jsonpatch[_0xfdc3('0x32')](_0x352499,_0x5da869,!![]);}catch(_0xa048be){return BPromise[_0xfdc3('0x33')](_0xa048be);}return _0x352499[_0xfdc3('0x34')]();};}function saveUpdates(_0x1be186,_0x497796){return function(_0x159615){if(_0x159615){return _0x159615[_0xfdc3('0x35')](_0x1be186)['then'](function(_0x31e91f){return _0x31e91f;});}return null;};}function removeEntity(_0x4a8d48,_0x323127){return function(_0x447e8e){if(_0x447e8e){return _0x447e8e[_0xfdc3('0x36')]()[_0xfdc3('0x20')](function(){_0x4a8d48['status'](0xcc)[_0xfdc3('0x2c')]();});}};}function handleEntityNotFound(_0x4ec5c6,_0x3c20e0){return function(_0x141cb0){if(!_0x141cb0){_0x4ec5c6[_0xfdc3('0x2a')](0x194);}return _0x141cb0;};}function handleError(_0x23d0de,_0x4ba21d){_0x4ba21d=_0x4ba21d||0x1f4;return function(_0x46d01a){logger[_0xfdc3('0x26')](_0x46d01a[_0xfdc3('0x37')]);if(_0x46d01a['name']){delete _0x46d01a[_0xfdc3('0x38')];}_0x23d0de['status'](_0x4ba21d)[_0xfdc3('0x39')](_0x46d01a);};}exports[_0xfdc3('0x3a')]=function(_0x1998bf,_0x1c1315){var _0x1ca07c={},_0x45a551={},_0x109a89={'count':0x0,'rows':[]};var _0x527914=_[_0xfdc3('0x3b')](db[_0xfdc3('0x3c')][_0xfdc3('0x3d')],function(_0x326f5d){return{'name':_0x326f5d['fieldName'],'type':_0x326f5d[_0xfdc3('0x3e')][_0xfdc3('0x3f')]};});_0x45a551['model']=_['map'](_0x527914,'name');_0x45a551['query']=_[_0xfdc3('0x40')](_0x1998bf['query']);_0x45a551['filters']=_[_0xfdc3('0x41')](_0x45a551[_0xfdc3('0x42')],_0x45a551[_0xfdc3('0x43')]);_0x1ca07c[_0xfdc3('0x44')]=_[_0xfdc3('0x41')](_0x45a551[_0xfdc3('0x42')],qs[_0xfdc3('0x45')](_0x1998bf['query'][_0xfdc3('0x45')]));_0x1ca07c['attributes']=_0x1ca07c[_0xfdc3('0x44')][_0xfdc3('0x46')]?_0x1ca07c[_0xfdc3('0x44')]:_0x45a551[_0xfdc3('0x42')];if(!_0x1998bf[_0xfdc3('0x43')][_0xfdc3('0x47')](_0xfdc3('0x48'))){_0x1ca07c[_0xfdc3('0x49')]=qs[_0xfdc3('0x49')](_0x1998bf['query'][_0xfdc3('0x49')]);_0x1ca07c[_0xfdc3('0x30')]=qs[_0xfdc3('0x30')](_0x1998bf[_0xfdc3('0x43')][_0xfdc3('0x30')]);}_0x1ca07c['order']=qs[_0xfdc3('0x4a')](_0x1998bf['query'][_0xfdc3('0x4a')]);_0x1ca07c[_0xfdc3('0x4b')]=qs[_0xfdc3('0x4c')](_['pick'](_0x1998bf[_0xfdc3('0x43')],_0x45a551[_0xfdc3('0x4c')]),_0x527914);if(_0x1998bf['query'][_0xfdc3('0x4d')]){_0x1ca07c[_0xfdc3('0x4b')]=_[_0xfdc3('0x4e')](_0x1ca07c[_0xfdc3('0x4b')],{'$or':_[_0xfdc3('0x3b')](_0x527914,function(_0x1fda7c){if(_0x1fda7c[_0xfdc3('0x3e')]!==_0xfdc3('0x4f')){var _0x3eedcc={};_0x3eedcc[_0x1fda7c[_0xfdc3('0x38')]]={'$like':'%'+_0x1998bf[_0xfdc3('0x43')]['filter']+'%'};return _0x3eedcc;}})});}_0x1ca07c=_[_0xfdc3('0x4e')]({},_0x1ca07c,_0x1998bf[_0xfdc3('0x50')]);var _0x5d5f26={'where':_0x1ca07c[_0xfdc3('0x4b')]};return db['ChatMessage'][_0xfdc3('0x2f')](_0x5d5f26)['then'](function(_0x5a8f75){_0x109a89[_0xfdc3('0x2f')]=_0x5a8f75;if(_0x1998bf[_0xfdc3('0x43')][_0xfdc3('0x51')]){_0x1ca07c[_0xfdc3('0x52')]=[{'all':!![]}];}return db[_0xfdc3('0x3c')][_0xfdc3('0x53')](_0x1ca07c);})[_0xfdc3('0x20')](function(_0x31d5ba){_0x109a89['rows']=_0x31d5ba;return _0x109a89;})[_0xfdc3('0x20')](respondWithFilteredResult(_0x1c1315,_0x1ca07c))[_0xfdc3('0x54')](handleError(_0x1c1315,null));};exports[_0xfdc3('0x55')]=function(_0x3894d1,_0x438092){var _0x4d2ae4={'raw':!![],'where':{'id':_0x3894d1['params']['id']}},_0x3b0008={};_0x3b0008['model']=_[_0xfdc3('0x40')](db[_0xfdc3('0x3c')][_0xfdc3('0x3d')]);_0x3b0008[_0xfdc3('0x43')]=_[_0xfdc3('0x40')](_0x3894d1['query']);_0x3b0008[_0xfdc3('0x4c')]=_[_0xfdc3('0x41')](_0x3b0008[_0xfdc3('0x42')],_0x3b0008[_0xfdc3('0x43')]);_0x4d2ae4[_0xfdc3('0x44')]=_[_0xfdc3('0x41')](_0x3b0008[_0xfdc3('0x42')],qs['fields'](_0x3894d1[_0xfdc3('0x43')]['fields']));_0x4d2ae4['attributes']=_0x4d2ae4[_0xfdc3('0x44')][_0xfdc3('0x46')]?_0x4d2ae4[_0xfdc3('0x44')]:_0x3b0008[_0xfdc3('0x42')];if(_0x3894d1[_0xfdc3('0x43')][_0xfdc3('0x51')]){_0x4d2ae4[_0xfdc3('0x52')]=[{'all':!![]}];}_0x4d2ae4=_[_0xfdc3('0x4e')]({},_0x4d2ae4,_0x3894d1[_0xfdc3('0x50')]);return db[_0xfdc3('0x3c')][_0xfdc3('0x56')](_0x4d2ae4)[_0xfdc3('0x20')](handleEntityNotFound(_0x438092,null))['then'](respondWithResult(_0x438092,null))[_0xfdc3('0x54')](handleError(_0x438092,null));};exports['create']=function(_0x24dfdf,_0x75c0a9){return db[_0xfdc3('0x3c')][_0xfdc3('0x57')](_0x24dfdf[_0xfdc3('0x58')],{})[_0xfdc3('0x20')](respondWithResult(_0x75c0a9,0xc9))[_0xfdc3('0x54')](handleError(_0x75c0a9,null));};exports[_0xfdc3('0x35')]=function(_0x5c62c0,_0x5519c4){if(_0x5c62c0[_0xfdc3('0x58')]['id']){delete _0x5c62c0[_0xfdc3('0x58')]['id'];}return db[_0xfdc3('0x3c')][_0xfdc3('0x56')]({'where':{'id':_0x5c62c0[_0xfdc3('0x59')]['id']}})[_0xfdc3('0x20')](handleEntityNotFound(_0x5519c4,null))[_0xfdc3('0x20')](saveUpdates(_0x5c62c0['body'],null))['then'](respondWithResult(_0x5519c4,null))['catch'](handleError(_0x5519c4,null));};exports[_0xfdc3('0x36')]=function(_0x5d1d63,_0x24304a){return db['ChatMessage'][_0xfdc3('0x56')]({'where':{'id':_0x5d1d63[_0xfdc3('0x59')]['id']}})[_0xfdc3('0x20')](handleEntityNotFound(_0x24304a,null))['then'](removeEntity(_0x24304a,null))[_0xfdc3('0x54')](handleError(_0x24304a,null));};exports[_0xfdc3('0x5a')]=function(_0x30a061,_0x4b7146){return db[_0xfdc3('0x3c')][_0xfdc3('0x5a')]()[_0xfdc3('0x20')](respondWithResult(_0x4b7146,null))['catch'](handleError(_0x4b7146,null));};var interaction_log=require(_0xfdc3('0x14'))(_0xfdc3('0x5b'));exports[_0xfdc3('0x5c')]=function(_0x1334a6,_0x4a51a4,_0x541753){var _0x126a06={'agent':{},'channel':_0xfdc3('0x5d')};if(_0x1334a6[_0xfdc3('0x58')]['id']){delete _0x1334a6['body']['id'];}_0x1334a6[_0xfdc3('0x58')][_0xfdc3('0x5e')]=!![];_0x1334a6[_0xfdc3('0x58')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1334a6[_0xfdc3('0x58')][_0xfdc3('0x5f')]=_0x1334a6[_0xfdc3('0x58')][_0xfdc3('0x5f')]||_0x1334a6[_0xfdc3('0x60')]['id'];_0x126a06[_0xfdc3('0x61')]['id']=_0x1334a6[_0xfdc3('0x58')][_0xfdc3('0x5f')];return db[_0xfdc3('0x3c')]['find']({'where':{'id':_0x1334a6[_0xfdc3('0x59')]['id'],'UserId':null}})[_0xfdc3('0x20')](handleEntityNotFound(_0x4a51a4,null))[_0xfdc3('0x20')](saveUpdates(_0x1334a6['body'],null))[_0xfdc3('0x20')](function(_0x14e6da){if(_0x14e6da){_0x126a06[_0xfdc3('0x28')]=_0x14e6da[_0xfdc3('0x62')]({'plain':!![]});return db[_0xfdc3('0x63')][_0xfdc3('0x56')]({'where':{'id':_0x14e6da[_0xfdc3('0x64')]}});}return null;})[_0xfdc3('0x20')](handleEntityNotFound(_0x4a51a4,null))[_0xfdc3('0x20')](function(_0x682933){if(_0x682933){return _0x682933['update']({'UserId':_0x1334a6['body'][_0xfdc3('0x5f')],'read1stAt':_[_0xfdc3('0x65')](_0x682933[_0xfdc3('0x66')])?moment()[_0xfdc3('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xfdc3('0x20')](function(_0x56761f){if(_0x56761f){_0x126a06[_0xfdc3('0x68')]=_0x56761f[_0xfdc3('0x62')]({'plain':!![]});interaction_log[_0xfdc3('0x21')](_0xfdc3('0x69'),_0x1334a6[_0xfdc3('0x60')]['id'],_0x1334a6[_0xfdc3('0x60')]['name'],_0x1334a6['user'][_0xfdc3('0x6a')],_0x126a06['interaction']['id'],_0x1334a6[_0xfdc3('0x58')]?JSON[_0xfdc3('0x25')](_0x1334a6[_0xfdc3('0x58')]):_0xfdc3('0x6b'));return respondWithRpcPromise(_0xfdc3('0x6c'),'acceptMessage',_0x126a06);}return null;})[_0xfdc3('0x20')](function(_0x1ce8f8){var _0x574c07=_0xfdc3('0x6d')+_0x1ce8f8[_0xfdc3('0x28')]['ContactId'];return db[_0xfdc3('0x6e')]['query'](_0x574c07,{'type':db['Sequelize'][_0xfdc3('0x6f')][_0xfdc3('0x70')],'raw':!![]})[_0xfdc3('0x20')](function(_0x40c6ee){return _0x40c6ee;});})[_0xfdc3('0x20')](function(_0x2dfcc2){if(_0x2dfcc2){_0x126a06[_0xfdc3('0x28')][_0xfdc3('0x71')]=_0x2dfcc2[0x0];if(!_0x1334a6['body'][_0xfdc3('0x5f')])return;return db['User']['find']({'where':{'id':_0x1334a6[_0xfdc3('0x58')][_0xfdc3('0x5f')],'role':'agent'},'attributes':['id',_0xfdc3('0x38'),_0xfdc3('0x72'),'email',_0xfdc3('0x73')],'raw':!![]});}return null;})[_0xfdc3('0x20')](function(_0x46b0ac){if(!_0x46b0ac)return null;_0x126a06[_0xfdc3('0x28')][_0xfdc3('0x61')]=_0x46b0ac;return _0x126a06;})['then'](function(_0x44b97f){if(_0x44b97f){if(_0x1334a6['body']['manual']){_0x126a06[_0xfdc3('0x28')][_0xfdc3('0x74')]=util[_0xfdc3('0x67')](_0xfdc3('0x75'),_0x1334a6[_0xfdc3('0x60')][_0xfdc3('0x38')]);_0x126a06['message'][_0xfdc3('0x76')]=_0x126a06[_0xfdc3('0x76')];_0x126a06[_0xfdc3('0x28')][_0xfdc3('0x77')]=_0x126a06[_0xfdc3('0x76')];_0x126a06[_0xfdc3('0x28')][_0xfdc3('0x78')]=_0xfdc3('0x5c');return respondWithRpcPromise('EventManager',_0xfdc3('0x79'),{'event':'acceptmessage','message':_[_0xfdc3('0x4e')](_0x126a06[_0xfdc3('0x28')],JSON[_0xfdc3('0x7a')](_0x126a06[_0xfdc3('0x68')][_0xfdc3('0x7b')]))},client9002)['then'](function(){return _0x126a06;});}return _0x126a06;}return null;})[_0xfdc3('0x20')](respondWithResult(_0x4a51a4,null))[_0xfdc3('0x54')](handleError(_0x4a51a4,null));};var interaction_log=require(_0xfdc3('0x14'))(_0xfdc3('0x5b'));exports[_0xfdc3('0x33')]=function(_0xf58a05,_0x5051ee,_0x130c98){var _0x16d297={'agent':{},'channel':'chat'};if(_0xf58a05['body']['id']){delete _0xf58a05['body']['id'];}_0xf58a05['body'][_0xfdc3('0x5f')]=_0xf58a05[_0xfdc3('0x58')]['UserId']||_0xf58a05[_0xfdc3('0x60')]['id'];_0x16d297[_0xfdc3('0x61')]['id']=_0xf58a05['body']['UserId'];return db['ChatMessage']['find']({'where':{'id':_0xf58a05[_0xfdc3('0x59')]['id'],'UserId':null}})[_0xfdc3('0x20')](handleEntityNotFound(_0x5051ee,null))[_0xfdc3('0x20')](function(_0x598471){if(_0x598471){_0x16d297[_0xfdc3('0x28')]=_0x598471['get']({'plain':!![]});return db[_0xfdc3('0x63')]['find']({'where':{'id':_0x598471['ChatInteractionId']}});}return null;})[_0xfdc3('0x20')](handleEntityNotFound(_0x5051ee,null))[_0xfdc3('0x20')](function(_0x5a8abc){if(_0x5a8abc){_0x16d297[_0xfdc3('0x68')]=_0x5a8abc[_0xfdc3('0x62')]({'plain':!![]});interaction_log[_0xfdc3('0x21')](_0xfdc3('0x7c'),_0xf58a05[_0xfdc3('0x60')]['id'],_0xf58a05[_0xfdc3('0x60')]['name'],_0xf58a05[_0xfdc3('0x60')][_0xfdc3('0x6a')],_0x16d297['interaction']['id'],_0xf58a05[_0xfdc3('0x58')]?JSON[_0xfdc3('0x25')](_0xf58a05['body']):_0xfdc3('0x6b'));return respondWithRpcPromise(_0xfdc3('0x7d'),_0xfdc3('0x7e'),_0x16d297);}return null;})[_0xfdc3('0x20')](function(_0x196b9d){var _0x4e9a24=_0xfdc3('0x6d')+_0x196b9d['message'][_0xfdc3('0x7f')];return db[_0xfdc3('0x6e')]['query'](_0x4e9a24,{'type':db[_0xfdc3('0x80')][_0xfdc3('0x6f')][_0xfdc3('0x70')],'raw':!![]})['then'](function(_0x3a542e){return _0x3a542e;});})[_0xfdc3('0x20')](function(_0x271a7e){if(_0x271a7e){_0x16d297[_0xfdc3('0x28')]['contact']=_0x271a7e[0x0];if(!_0xf58a05[_0xfdc3('0x58')]['UserId'])return;return db[_0xfdc3('0x81')]['find']({'where':{'id':_0xf58a05[_0xfdc3('0x58')][_0xfdc3('0x5f')],'role':_0xfdc3('0x61')},'attributes':['id',_0xfdc3('0x38'),_0xfdc3('0x72'),_0xfdc3('0x82'),_0xfdc3('0x73')],'raw':!![]});}return null;})['then'](function(_0x4b4024){if(!_0x4b4024)return null;_0x16d297[_0xfdc3('0x28')][_0xfdc3('0x61')]=_0x4b4024;return _0x16d297;})['then'](function(_0x604d53){if(_0x604d53){_0x604d53['message']['interface']=util[_0xfdc3('0x67')](_0xfdc3('0x75'),_0xf58a05['user'][_0xfdc3('0x38')]);_0x604d53['message'][_0xfdc3('0x76')]=_0x16d297[_0xfdc3('0x76')];_0x604d53['message'][_0xfdc3('0x77')]=_0x16d297[_0xfdc3('0x76')];_0x604d53[_0xfdc3('0x28')][_0xfdc3('0x78')]=_0xfdc3('0x33');respondWithRpcPromise(_0xfdc3('0x79'),_0xfdc3('0x79'),{'event':'rejectmessage','message':_[_0xfdc3('0x4e')](_0x16d297[_0xfdc3('0x28')],JSON[_0xfdc3('0x7a')](_0x16d297[_0xfdc3('0x68')][_0xfdc3('0x7b')]))},client9002);return _0x16d297;}return null;})[_0xfdc3('0x20')](respondWithResult(_0x5051ee,null))['catch'](handleError(_0x5051ee,null));};
\ No newline at end of file
+var _0xf753=['limit','count','set','Content-Range','apply','save','update','sendStatus','stack','name','index','map','ChatMessage','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','keys','includeAll','find','create','body','destroy','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','User','reject','rejectmessage','rimraf','zip-dir','fast-json-patch','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','offset','undefined'];(function(_0x2d069d,_0x52790a){var _0x8a2ada=function(_0x2798f2){while(--_0x2798f2){_0x2d069d['push'](_0x2d069d['shift']());}};_0x8a2ada(++_0x52790a);}(_0xf753,0xd9));var _0x3f75=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xf753[_0x4e7d25];return _0x526fe6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f75('0x0'));var zipdir=require(_0x3f75('0x1'));var jsonpatch=require(_0x3f75('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3f75('0x3'));var Mustache=require('mustache');var util=require(_0x3f75('0x4'));var path=require(_0x3f75('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3f75('0x6'));var fs=require('fs');var fs_extra=require(_0x3f75('0x7'));var _=require(_0x3f75('0x8'));var squel=require(_0x3f75('0x9'));var crypto=require(_0x3f75('0xa'));var jsforce=require(_0x3f75('0xb'));var deskjs=require(_0x3f75('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3f75('0xd'));var Papa=require(_0x3f75('0xe'));var Redis=require('ioredis');var authService=require(_0x3f75('0xf'));var qs=require(_0x3f75('0x10'));var as=require(_0x3f75('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f75('0x12'))('api');var utils=require(_0x3f75('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3f75('0x14'))['db'];config[_0x3f75('0x15')]=_['defaults'](config[_0x3f75('0x15')],{'host':_0x3f75('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3f75('0x17'))[_0x3f75('0x18')](socket);var jayson=require(_0x3f75('0x19'));var client=jayson[_0x3f75('0x1a')][_0x3f75('0x1b')]({'port':0x232c});var client9002=jayson[_0x3f75('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x288775,_0x2e486b,_0x41f55d,_0x42881b){return new BPromise(function(_0x119b1f,_0x2ed751){var _0x4d4407=_0x42881b||client;return _0x4d4407[_0x3f75('0x1c')](_0x288775,_0x41f55d)[_0x3f75('0x1d')](function(_0x309314){logger[_0x3f75('0x1e')](_0x3f75('0x1f'),_0x2e486b,_0x3f75('0x20'));logger['debug'](_0x3f75('0x21'),_0x2e486b,'request\x20sent',JSON[_0x3f75('0x22')](_0x309314));if(_0x309314[_0x3f75('0x23')]){if(_0x309314[_0x3f75('0x23')]['code']===0x1f4){logger[_0x3f75('0x23')](_0x3f75('0x1f'),_0x2e486b,_0x309314[_0x3f75('0x23')]['message']);return _0x2ed751(_0x309314['error'][_0x3f75('0x24')]);}logger[_0x3f75('0x23')](_0x3f75('0x1f'),_0x2e486b,_0x309314[_0x3f75('0x23')][_0x3f75('0x24')]);return _0x119b1f(_0x309314[_0x3f75('0x23')]['message']);}else{logger[_0x3f75('0x1e')](_0x3f75('0x1f'),_0x2e486b,_0x3f75('0x20'));_0x119b1f(_0x309314['result'][_0x3f75('0x24')]);}})[_0x3f75('0x25')](function(_0x7652d6){logger['error']('ChatMessage,\x20%s,\x20%s',_0x2e486b,_0x7652d6);_0x2ed751(_0x7652d6);});});}function respondWithStatusCode(_0x1e11fd,_0x3af1a0){_0x3af1a0=_0x3af1a0||0xcc;return function(_0x492aad){if(_0x492aad){return _0x1e11fd['sendStatus'](_0x3af1a0);}return _0x1e11fd[_0x3f75('0x26')](_0x3af1a0)[_0x3f75('0x27')]();};}function respondWithResult(_0x372893,_0x5ec901){_0x5ec901=_0x5ec901||0xc8;return function(_0x208917){if(_0x208917){return _0x372893['status'](_0x5ec901)[_0x3f75('0x28')](_0x208917);}};}function respondWithFilteredResult(_0x42d372,_0x7ee4e0){return function(_0x182be4){if(_0x182be4){var _0x4967dc=typeof _0x7ee4e0[_0x3f75('0x29')]===_0x3f75('0x2a')&&typeof _0x7ee4e0[_0x3f75('0x2b')]==='undefined';var _0x587acd=_0x182be4[_0x3f75('0x2c')];var _0x143b9c=_0x4967dc?0x0:_0x7ee4e0[_0x3f75('0x29')];var _0x5d8d66=_0x4967dc?_0x182be4[_0x3f75('0x2c')]:_0x7ee4e0[_0x3f75('0x29')]+_0x7ee4e0[_0x3f75('0x2b')];var _0x516db4;if(_0x5d8d66>=_0x587acd){_0x5d8d66=_0x587acd;_0x516db4=0xc8;}else{_0x516db4=0xce;}_0x42d372[_0x3f75('0x26')](_0x516db4);return _0x42d372[_0x3f75('0x2d')](_0x3f75('0x2e'),_0x143b9c+'-'+_0x5d8d66+'/'+_0x587acd)['json'](_0x182be4);}return null;};}function patchUpdates(_0x1cfcb6){return function(_0x2f37ab){try{jsonpatch[_0x3f75('0x2f')](_0x2f37ab,_0x1cfcb6,!![]);}catch(_0x52e409){return BPromise['reject'](_0x52e409);}return _0x2f37ab[_0x3f75('0x30')]();};}function saveUpdates(_0x339135,_0x1eeb58){return function(_0x319228){if(_0x319228){return _0x319228[_0x3f75('0x31')](_0x339135)[_0x3f75('0x1d')](function(_0x161786){return _0x161786;});}return null;};}function removeEntity(_0x52cabc,_0x340c51){return function(_0x56e010){if(_0x56e010){return _0x56e010['destroy']()[_0x3f75('0x1d')](function(){_0x52cabc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37a824,_0x40a651){return function(_0x49269f){if(!_0x49269f){_0x37a824[_0x3f75('0x32')](0x194);}return _0x49269f;};}function handleError(_0x221014,_0x18192e){_0x18192e=_0x18192e||0x1f4;return function(_0x389d47){logger[_0x3f75('0x23')](_0x389d47[_0x3f75('0x33')]);if(_0x389d47[_0x3f75('0x34')]){delete _0x389d47[_0x3f75('0x34')];}_0x221014['status'](_0x18192e)['send'](_0x389d47);};}exports[_0x3f75('0x35')]=function(_0x1aa009,_0x3a832c){var _0x529662={},_0x118d5b={},_0x375e22={'count':0x0,'rows':[]};var _0x4e5d83=_[_0x3f75('0x36')](db[_0x3f75('0x37')][_0x3f75('0x38')],function(_0xff7726){return{'name':_0xff7726['fieldName'],'type':_0xff7726[_0x3f75('0x39')]['key']};});_0x118d5b['model']=_[_0x3f75('0x36')](_0x4e5d83,_0x3f75('0x34'));_0x118d5b['query']=_['keys'](_0x1aa009[_0x3f75('0x3a')]);_0x118d5b[_0x3f75('0x3b')]=_[_0x3f75('0x3c')](_0x118d5b[_0x3f75('0x3d')],_0x118d5b['query']);_0x529662[_0x3f75('0x3e')]=_['intersection'](_0x118d5b['model'],qs[_0x3f75('0x3f')](_0x1aa009[_0x3f75('0x3a')][_0x3f75('0x3f')]));_0x529662[_0x3f75('0x3e')]=_0x529662[_0x3f75('0x3e')][_0x3f75('0x40')]?_0x529662['attributes']:_0x118d5b[_0x3f75('0x3d')];if(!_0x1aa009[_0x3f75('0x3a')][_0x3f75('0x41')](_0x3f75('0x42'))){_0x529662[_0x3f75('0x2b')]=qs[_0x3f75('0x2b')](_0x1aa009[_0x3f75('0x3a')][_0x3f75('0x2b')]);_0x529662['offset']=qs[_0x3f75('0x29')](_0x1aa009[_0x3f75('0x3a')]['offset']);}_0x529662[_0x3f75('0x43')]=qs[_0x3f75('0x44')](_0x1aa009[_0x3f75('0x3a')]['sort']);_0x529662[_0x3f75('0x45')]=qs[_0x3f75('0x3b')](_[_0x3f75('0x46')](_0x1aa009[_0x3f75('0x3a')],_0x118d5b[_0x3f75('0x3b')]),_0x4e5d83);if(_0x1aa009[_0x3f75('0x3a')][_0x3f75('0x47')]){_0x529662[_0x3f75('0x45')]=_[_0x3f75('0x48')](_0x529662['where'],{'$or':_['map'](_0x4e5d83,function(_0x513899){if(_0x513899[_0x3f75('0x39')]!==_0x3f75('0x49')){var _0x2e87f0={};_0x2e87f0[_0x513899[_0x3f75('0x34')]]={'$like':'%'+_0x1aa009[_0x3f75('0x3a')][_0x3f75('0x47')]+'%'};return _0x2e87f0;}})});}_0x529662=_[_0x3f75('0x48')]({},_0x529662,_0x1aa009[_0x3f75('0x4a')]);var _0x497f77={'where':_0x529662[_0x3f75('0x45')]};return db[_0x3f75('0x37')][_0x3f75('0x2c')](_0x497f77)[_0x3f75('0x1d')](function(_0x2f1054){_0x375e22[_0x3f75('0x2c')]=_0x2f1054;if(_0x1aa009[_0x3f75('0x3a')]['includeAll']){_0x529662[_0x3f75('0x4b')]=[{'all':!![]}];}return db[_0x3f75('0x37')]['findAll'](_0x529662);})[_0x3f75('0x1d')](function(_0x2be58e){_0x375e22[_0x3f75('0x4c')]=_0x2be58e;return _0x375e22;})[_0x3f75('0x1d')](respondWithFilteredResult(_0x3a832c,_0x529662))[_0x3f75('0x25')](handleError(_0x3a832c,null));};exports[_0x3f75('0x4d')]=function(_0x4bed43,_0x40e7b3){var _0x3fbd23={'raw':!![],'where':{'id':_0x4bed43[_0x3f75('0x4e')]['id']}},_0x33c4ca={};_0x33c4ca[_0x3f75('0x3d')]=_[_0x3f75('0x4f')](db[_0x3f75('0x37')][_0x3f75('0x38')]);_0x33c4ca[_0x3f75('0x3a')]=_[_0x3f75('0x4f')](_0x4bed43['query']);_0x33c4ca[_0x3f75('0x3b')]=_[_0x3f75('0x3c')](_0x33c4ca[_0x3f75('0x3d')],_0x33c4ca[_0x3f75('0x3a')]);_0x3fbd23['attributes']=_[_0x3f75('0x3c')](_0x33c4ca[_0x3f75('0x3d')],qs[_0x3f75('0x3f')](_0x4bed43[_0x3f75('0x3a')][_0x3f75('0x3f')]));_0x3fbd23[_0x3f75('0x3e')]=_0x3fbd23[_0x3f75('0x3e')][_0x3f75('0x40')]?_0x3fbd23[_0x3f75('0x3e')]:_0x33c4ca[_0x3f75('0x3d')];if(_0x4bed43[_0x3f75('0x3a')][_0x3f75('0x50')]){_0x3fbd23[_0x3f75('0x4b')]=[{'all':!![]}];}_0x3fbd23=_[_0x3f75('0x48')]({},_0x3fbd23,_0x4bed43[_0x3f75('0x4a')]);return db[_0x3f75('0x37')][_0x3f75('0x51')](_0x3fbd23)[_0x3f75('0x1d')](handleEntityNotFound(_0x40e7b3,null))[_0x3f75('0x1d')](respondWithResult(_0x40e7b3,null))['catch'](handleError(_0x40e7b3,null));};exports[_0x3f75('0x52')]=function(_0x88e95a,_0x4807ae){return db['ChatMessage'][_0x3f75('0x52')](_0x88e95a[_0x3f75('0x53')],{})['then'](respondWithResult(_0x4807ae,0xc9))[_0x3f75('0x25')](handleError(_0x4807ae,null));};exports['update']=function(_0x2b8dea,_0x4966c5){if(_0x2b8dea[_0x3f75('0x53')]['id']){delete _0x2b8dea[_0x3f75('0x53')]['id'];}return db[_0x3f75('0x37')][_0x3f75('0x51')]({'where':{'id':_0x2b8dea['params']['id']}})[_0x3f75('0x1d')](handleEntityNotFound(_0x4966c5,null))[_0x3f75('0x1d')](saveUpdates(_0x2b8dea[_0x3f75('0x53')],null))[_0x3f75('0x1d')](respondWithResult(_0x4966c5,null))[_0x3f75('0x25')](handleError(_0x4966c5,null));};exports[_0x3f75('0x54')]=function(_0x431729,_0x3a3980){return db[_0x3f75('0x37')][_0x3f75('0x51')]({'where':{'id':_0x431729[_0x3f75('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a3980,null))[_0x3f75('0x1d')](removeEntity(_0x3a3980,null))['catch'](handleError(_0x3a3980,null));};exports[_0x3f75('0x55')]=function(_0x4fc22a,_0x16df12){return db[_0x3f75('0x37')][_0x3f75('0x55')]()[_0x3f75('0x1d')](respondWithResult(_0x16df12,null))[_0x3f75('0x25')](handleError(_0x16df12,null));};var interaction_log=require(_0x3f75('0x12'))(_0x3f75('0x56'));exports[_0x3f75('0x57')]=function(_0x17b5cf,_0x1b5806,_0x53f618){var _0x36df3b={'agent':{},'channel':_0x3f75('0x58')};if(_0x17b5cf[_0x3f75('0x53')]['id']){delete _0x17b5cf['body']['id'];}_0x17b5cf['body'][_0x3f75('0x59')]=!![];_0x17b5cf[_0x3f75('0x53')][_0x3f75('0x5a')]=moment()[_0x3f75('0x5b')](_0x3f75('0x5c'));_0x17b5cf[_0x3f75('0x53')][_0x3f75('0x5d')]=_0x17b5cf[_0x3f75('0x53')][_0x3f75('0x5d')]||_0x17b5cf[_0x3f75('0x5e')]['id'];_0x36df3b[_0x3f75('0x5f')]['id']=_0x17b5cf[_0x3f75('0x53')][_0x3f75('0x5d')];return db[_0x3f75('0x37')]['find']({'where':{'id':_0x17b5cf[_0x3f75('0x4e')]['id'],'UserId':null}})[_0x3f75('0x1d')](handleEntityNotFound(_0x1b5806,null))['then'](saveUpdates(_0x17b5cf[_0x3f75('0x53')],null))[_0x3f75('0x1d')](function(_0x187c43){if(_0x187c43){_0x36df3b[_0x3f75('0x24')]=_0x187c43[_0x3f75('0x60')]({'plain':!![]});return db[_0x3f75('0x61')][_0x3f75('0x51')]({'where':{'id':_0x187c43[_0x3f75('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x1b5806,null))['then'](function(_0xc207b7){if(_0xc207b7){return _0xc207b7[_0x3f75('0x31')]({'UserId':_0x17b5cf[_0x3f75('0x53')]['UserId'],'read1stAt':_['isNil'](_0xc207b7[_0x3f75('0x63')])?moment()[_0x3f75('0x5b')](_0x3f75('0x5c')):undefined});}return null;})[_0x3f75('0x1d')](function(_0x339e9b){if(_0x339e9b){_0x36df3b[_0x3f75('0x64')]=_0x339e9b[_0x3f75('0x60')]({'plain':!![]});interaction_log[_0x3f75('0x1e')](_0x3f75('0x65'),_0x17b5cf['user']['id'],_0x17b5cf[_0x3f75('0x5e')]['name'],_0x17b5cf[_0x3f75('0x5e')][_0x3f75('0x66')],_0x36df3b[_0x3f75('0x64')]['id'],_0x17b5cf[_0x3f75('0x53')]?JSON[_0x3f75('0x22')](_0x17b5cf[_0x3f75('0x53')]):_0x3f75('0x67'));return respondWithRpcPromise(_0x3f75('0x68'),'acceptMessage',_0x36df3b);}return null;})[_0x3f75('0x1d')](function(_0x44a8b8){var _0x1ec4b4=_0x3f75('0x69')+_0x44a8b8[_0x3f75('0x24')][_0x3f75('0x6a')];return db[_0x3f75('0x6b')][_0x3f75('0x3a')](_0x1ec4b4,{'type':db[_0x3f75('0x6c')]['QueryTypes'][_0x3f75('0x6d')],'raw':!![]})[_0x3f75('0x1d')](function(_0x142c36){return _0x142c36;});})['then'](function(_0x4f2d00){if(_0x4f2d00){_0x36df3b['message'][_0x3f75('0x6e')]=_0x4f2d00[0x0];if(!_0x17b5cf[_0x3f75('0x53')][_0x3f75('0x5d')])return;return db['User']['find']({'where':{'id':_0x17b5cf[_0x3f75('0x53')][_0x3f75('0x5d')],'role':'agent'},'attributes':['id',_0x3f75('0x34'),_0x3f75('0x6f'),_0x3f75('0x70'),_0x3f75('0x71')],'raw':!![]});}return null;})[_0x3f75('0x1d')](function(_0x5f5922){if(!_0x5f5922)return null;_0x36df3b[_0x3f75('0x24')][_0x3f75('0x5f')]=_0x5f5922;return _0x36df3b;})[_0x3f75('0x1d')](function(_0x4c629b){if(_0x4c629b){if(_0x17b5cf['body'][_0x3f75('0x72')]){_0x36df3b[_0x3f75('0x24')][_0x3f75('0x73')]=util[_0x3f75('0x5b')](_0x3f75('0x74'),_0x17b5cf['user'][_0x3f75('0x34')]);_0x36df3b[_0x3f75('0x24')]['channel']=_0x36df3b[_0x3f75('0x75')];_0x36df3b['message'][_0x3f75('0x76')]=_0x36df3b['channel'];_0x36df3b[_0x3f75('0x24')][_0x3f75('0x77')]=_0x3f75('0x57');return respondWithRpcPromise(_0x3f75('0x78'),'EventManager',{'event':_0x3f75('0x79'),'message':_[_0x3f75('0x48')](_0x36df3b['message'],JSON[_0x3f75('0x7a')](_0x36df3b['interaction'][_0x3f75('0x7b')]))},client9002)[_0x3f75('0x1d')](function(){return _0x36df3b;});}return _0x36df3b;}return null;})['then'](respondWithResult(_0x1b5806,null))['catch'](handleError(_0x1b5806,null));};var interaction_log=require(_0x3f75('0x12'))(_0x3f75('0x56'));exports['reject']=function(_0x365917,_0x53b864,_0x4ecd53){var _0x53d420={'agent':{},'channel':_0x3f75('0x58')};if(_0x365917[_0x3f75('0x53')]['id']){delete _0x365917[_0x3f75('0x53')]['id'];}_0x365917['body'][_0x3f75('0x5d')]=_0x365917[_0x3f75('0x53')][_0x3f75('0x5d')]||_0x365917[_0x3f75('0x5e')]['id'];_0x53d420[_0x3f75('0x5f')]['id']=_0x365917['body'][_0x3f75('0x5d')];return db['ChatMessage'][_0x3f75('0x51')]({'where':{'id':_0x365917['params']['id'],'UserId':null}})[_0x3f75('0x1d')](handleEntityNotFound(_0x53b864,null))[_0x3f75('0x1d')](function(_0x34e8bf){if(_0x34e8bf){_0x53d420[_0x3f75('0x24')]=_0x34e8bf[_0x3f75('0x60')]({'plain':!![]});return db[_0x3f75('0x61')]['find']({'where':{'id':_0x34e8bf['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x53b864,null))['then'](function(_0x105c90){if(_0x105c90){_0x53d420[_0x3f75('0x64')]=_0x105c90[_0x3f75('0x60')]({'plain':!![]});interaction_log[_0x3f75('0x1e')](_0x3f75('0x7c'),_0x365917[_0x3f75('0x5e')]['id'],_0x365917[_0x3f75('0x5e')]['name'],_0x365917[_0x3f75('0x5e')][_0x3f75('0x66')],_0x53d420[_0x3f75('0x64')]['id'],_0x365917['body']?JSON[_0x3f75('0x22')](_0x365917[_0x3f75('0x53')]):_0x3f75('0x67'));return respondWithRpcPromise(_0x3f75('0x7d'),'rejectMessage',_0x53d420);}return null;})[_0x3f75('0x1d')](function(_0x479c69){var _0x2d2db0=_0x3f75('0x69')+_0x479c69['message'][_0x3f75('0x6a')];return db['sequelize'][_0x3f75('0x3a')](_0x2d2db0,{'type':db[_0x3f75('0x6c')][_0x3f75('0x7e')][_0x3f75('0x6d')],'raw':!![]})[_0x3f75('0x1d')](function(_0x244ff1){return _0x244ff1;});})[_0x3f75('0x1d')](function(_0x1c8207){if(_0x1c8207){_0x53d420[_0x3f75('0x24')][_0x3f75('0x6e')]=_0x1c8207[0x0];if(!_0x365917[_0x3f75('0x53')]['UserId'])return;return db[_0x3f75('0x7f')][_0x3f75('0x51')]({'where':{'id':_0x365917[_0x3f75('0x53')][_0x3f75('0x5d')],'role':_0x3f75('0x5f')},'attributes':['id',_0x3f75('0x34'),_0x3f75('0x6f'),_0x3f75('0x70'),_0x3f75('0x71')],'raw':!![]});}return null;})[_0x3f75('0x1d')](function(_0x2924e6){if(!_0x2924e6)return null;_0x53d420[_0x3f75('0x24')]['agent']=_0x2924e6;return _0x53d420;})[_0x3f75('0x1d')](function(_0x4ba416){if(_0x4ba416){_0x4ba416[_0x3f75('0x24')]['interface']=util[_0x3f75('0x5b')](_0x3f75('0x74'),_0x365917[_0x3f75('0x5e')]['name']);_0x4ba416[_0x3f75('0x24')][_0x3f75('0x75')]=_0x53d420[_0x3f75('0x75')];_0x4ba416[_0x3f75('0x24')]['motionChannel']=_0x53d420[_0x3f75('0x75')];_0x4ba416[_0x3f75('0x24')][_0x3f75('0x77')]=_0x3f75('0x80');respondWithRpcPromise(_0x3f75('0x78'),_0x3f75('0x78'),{'event':_0x3f75('0x81'),'message':_[_0x3f75('0x48')](_0x53d420[_0x3f75('0x24')],JSON[_0x3f75('0x7a')](_0x53d420[_0x3f75('0x64')]['formData']))},client9002);return _0x53d420;}return null;})[_0x3f75('0x1d')](respondWithResult(_0x53b864,null))[_0x3f75('0x25')](handleError(_0x53b864,null));};
\ No newline at end of file