Built motion from commit 9d7072cc.|2.5.39
[motion2.git] / server / api / openchannelMessage / openchannelMessage.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x7f2f=['get','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','contact','internal','motionChannel','rejectmessage','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','show','params','keys','intersection','create','body','find','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','User','fullname','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage'];(function(_0x3c2a27,_0x19a7c8){var _0x27bd63=function(_0x538259){while(--_0x538259){_0x3c2a27['push'](_0x3c2a27['shift']());}};_0x27bd63(++_0x19a7c8);}(_0x7f2f,0x11c));var _0xf7f2=function(_0x551bc1,_0x47cff3){_0x551bc1=_0x551bc1-0x0;var _0x12ea5e=_0x7f2f[_0x551bc1];return _0x12ea5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7f2('0x0'));var zipdir=require(_0xf7f2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7f2('0x2'));var moment=require(_0xf7f2('0x3'));var BPromise=require(_0xf7f2('0x4'));var Mustache=require(_0xf7f2('0x5'));var util=require(_0xf7f2('0x6'));var path=require('path');var sox=require(_0xf7f2('0x7'));var csv=require('to-csv');var ejs=require(_0xf7f2('0x8'));var fs=require('fs');var fs_extra=require(_0xf7f2('0x9'));var _=require('lodash');var squel=require(_0xf7f2('0xa'));var crypto=require(_0xf7f2('0xb'));var jsforce=require(_0xf7f2('0xc'));var deskjs=require(_0xf7f2('0xd'));var toCsv=require(_0xf7f2('0xe'));var querystring=require(_0xf7f2('0xf'));var Papa=require(_0xf7f2('0x10'));var Redis=require('ioredis');var authService=require(_0xf7f2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf7f2('0x12'));var hardwareService=require(_0xf7f2('0x13'));var logger=require(_0xf7f2('0x14'))(_0xf7f2('0x15'));var utils=require(_0xf7f2('0x16'));var config=require(_0xf7f2('0x17'));var licenseUtil=require(_0xf7f2('0x18'));var db=require(_0xf7f2('0x19'))['db'];config[_0xf7f2('0x1a')]=_[_0xf7f2('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf7f2('0x1a')]));require(_0xf7f2('0x1c'))[_0xf7f2('0x1d')](socket);var jayson=require(_0xf7f2('0x1e'));var client=jayson[_0xf7f2('0x1f')][_0xf7f2('0x20')]({'port':0x232c});var client9002=jayson[_0xf7f2('0x1f')][_0xf7f2('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1d46c6,_0x2e5c99,_0xa9d5b,_0x35d292){return new BPromise(function(_0x4ddb85,_0xb69554){var _0x7d8765=_0x35d292||client;return _0x7d8765[_0xf7f2('0x21')](_0x1d46c6,_0xa9d5b)[_0xf7f2('0x22')](function(_0x132c7b){logger['info'](_0xf7f2('0x23'),_0x2e5c99,_0xf7f2('0x24'));logger[_0xf7f2('0x25')](_0xf7f2('0x26'),_0x2e5c99,_0xf7f2('0x24'),JSON['stringify'](_0x132c7b));if(_0x132c7b[_0xf7f2('0x27')]){if(_0x132c7b[_0xf7f2('0x27')]['code']===0x1f4){logger[_0xf7f2('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x2e5c99,_0x132c7b[_0xf7f2('0x27')]['message']);return _0xb69554(_0x132c7b['error'][_0xf7f2('0x28')]);}logger['error'](_0xf7f2('0x23'),_0x2e5c99,_0x132c7b[_0xf7f2('0x27')][_0xf7f2('0x28')]);return _0x4ddb85(_0x132c7b[_0xf7f2('0x27')][_0xf7f2('0x28')]);}else{logger[_0xf7f2('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x2e5c99,_0xf7f2('0x24'));_0x4ddb85(_0x132c7b[_0xf7f2('0x2a')][_0xf7f2('0x28')]);}})[_0xf7f2('0x2b')](function(_0x5f69b1){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2e5c99,_0x5f69b1);_0xb69554(_0x5f69b1);});});}function respondWithStatusCode(_0x135773,_0x50446a){_0x50446a=_0x50446a||0xcc;return function(_0x4b3652){if(_0x4b3652){return _0x135773[_0xf7f2('0x2c')](_0x50446a);}return _0x135773['status'](_0x50446a)['end']();};}function respondWithResult(_0x2c655f,_0xfe0bc2){_0xfe0bc2=_0xfe0bc2||0xc8;return function(_0x218f13){if(_0x218f13){return _0x2c655f[_0xf7f2('0x2d')](_0xfe0bc2)[_0xf7f2('0x2e')](_0x218f13);}};}function respondWithFilteredResult(_0xc99720,_0x3a49e9){return function(_0x3df2ce){if(_0x3df2ce){var _0x1dba11=typeof _0x3a49e9[_0xf7f2('0x2f')]===_0xf7f2('0x30')&&typeof _0x3a49e9[_0xf7f2('0x31')]===_0xf7f2('0x30');var _0x77a00d=_0x3df2ce['count'];var _0x56dca8=_0x1dba11?0x0:_0x3a49e9[_0xf7f2('0x2f')];var _0xea1435=_0x1dba11?_0x3df2ce['count']:_0x3a49e9[_0xf7f2('0x2f')]+_0x3a49e9[_0xf7f2('0x31')];var _0xc54eda;if(_0xea1435>=_0x77a00d){_0xea1435=_0x77a00d;_0xc54eda=0xc8;}else{_0xc54eda=0xce;}_0xc99720['status'](_0xc54eda);return _0xc99720[_0xf7f2('0x32')]('Content-Range',_0x56dca8+'-'+_0xea1435+'/'+_0x77a00d)[_0xf7f2('0x2e')](_0x3df2ce);}return null;};}function patchUpdates(_0x4a08a3){return function(_0x233aed){try{jsonpatch[_0xf7f2('0x33')](_0x233aed,_0x4a08a3,!![]);}catch(_0x166e40){return BPromise[_0xf7f2('0x34')](_0x166e40);}return _0x233aed[_0xf7f2('0x35')]();};}function saveUpdates(_0x564bbd,_0x2cca8e){return function(_0x42080a){if(_0x42080a){return _0x42080a[_0xf7f2('0x36')](_0x564bbd)['then'](function(_0x1a7c96){return _0x1a7c96;});}return null;};}function removeEntity(_0x2fde77,_0x3d38b1){return function(_0x2881a9){if(_0x2881a9){return _0x2881a9[_0xf7f2('0x37')]()['then'](function(){_0x2fde77[_0xf7f2('0x2d')](0xcc)[_0xf7f2('0x38')]();});}};}function handleEntityNotFound(_0x56955b,_0x1a3cdc){return function(_0x30562e){if(!_0x30562e){_0x56955b[_0xf7f2('0x2c')](0x194);}return _0x30562e;};}function handleError(_0x209c29,_0x45dd8e){_0x45dd8e=_0x45dd8e||0x1f4;return function(_0x4b26e4){logger[_0xf7f2('0x27')](_0x4b26e4[_0xf7f2('0x39')]);if(_0x4b26e4[_0xf7f2('0x3a')]){delete _0x4b26e4[_0xf7f2('0x3a')];}_0x209c29[_0xf7f2('0x2d')](_0x45dd8e)[_0xf7f2('0x3b')](_0x4b26e4);};}exports[_0xf7f2('0x3c')]=function(_0x41eaa8,_0x463965){var _0x486f46={},_0x379577={},_0x4ab18a={'count':0x0,'rows':[]};var _0x425cfd=_[_0xf7f2('0x3d')](db[_0xf7f2('0x3e')][_0xf7f2('0x3f')],function(_0x3f099f){return{'name':_0x3f099f[_0xf7f2('0x40')],'type':_0x3f099f[_0xf7f2('0x41')][_0xf7f2('0x42')]};});_0x379577[_0xf7f2('0x43')]=_[_0xf7f2('0x3d')](_0x425cfd,_0xf7f2('0x3a'));_0x379577[_0xf7f2('0x44')]=_['keys'](_0x41eaa8[_0xf7f2('0x44')]);_0x379577[_0xf7f2('0x45')]=_['intersection'](_0x379577[_0xf7f2('0x43')],_0x379577[_0xf7f2('0x44')]);_0x486f46[_0xf7f2('0x46')]=_['intersection'](_0x379577[_0xf7f2('0x43')],qs[_0xf7f2('0x47')](_0x41eaa8[_0xf7f2('0x44')][_0xf7f2('0x47')]));_0x486f46[_0xf7f2('0x46')]=_0x486f46[_0xf7f2('0x46')][_0xf7f2('0x48')]?_0x486f46[_0xf7f2('0x46')]:_0x379577['model'];if(!_0x41eaa8[_0xf7f2('0x44')][_0xf7f2('0x49')](_0xf7f2('0x4a'))){_0x486f46['limit']=qs[_0xf7f2('0x31')](_0x41eaa8[_0xf7f2('0x44')][_0xf7f2('0x31')]);_0x486f46[_0xf7f2('0x2f')]=qs[_0xf7f2('0x2f')](_0x41eaa8['query'][_0xf7f2('0x2f')]);}_0x486f46[_0xf7f2('0x4b')]=qs[_0xf7f2('0x4c')](_0x41eaa8[_0xf7f2('0x44')][_0xf7f2('0x4c')]);_0x486f46[_0xf7f2('0x4d')]=qs[_0xf7f2('0x45')](_[_0xf7f2('0x4e')](_0x41eaa8['query'],_0x379577[_0xf7f2('0x45')]),_0x425cfd);if(_0x41eaa8[_0xf7f2('0x44')][_0xf7f2('0x4f')]){_0x486f46[_0xf7f2('0x4d')]=_['merge'](_0x486f46[_0xf7f2('0x4d')],{'$or':_['map'](_0x425cfd,function(_0x4ad33f){if(_0x4ad33f['type']!==_0xf7f2('0x50')){var _0x28e08b={};_0x28e08b[_0x4ad33f[_0xf7f2('0x3a')]]={'$like':'%'+_0x41eaa8['query'][_0xf7f2('0x4f')]+'%'};return _0x28e08b;}})});}_0x486f46=_[_0xf7f2('0x51')]({},_0x486f46,_0x41eaa8[_0xf7f2('0x52')]);var _0x1ad93d={'where':_0x486f46['where']};return db['OpenchannelMessage'][_0xf7f2('0x53')](_0x1ad93d)['then'](function(_0x4e22ab){_0x4ab18a[_0xf7f2('0x53')]=_0x4e22ab;if(_0x41eaa8[_0xf7f2('0x44')][_0xf7f2('0x54')]){_0x486f46[_0xf7f2('0x55')]=[{'all':!![]}];}return db[_0xf7f2('0x3e')][_0xf7f2('0x56')](_0x486f46);})[_0xf7f2('0x22')](function(_0x1cb33b){_0x4ab18a['rows']=_0x1cb33b;return _0x4ab18a;})[_0xf7f2('0x22')](respondWithFilteredResult(_0x463965,_0x486f46))[_0xf7f2('0x2b')](handleError(_0x463965,null));};exports[_0xf7f2('0x57')]=function(_0x5ad47a,_0x6d7eb){var _0xd58e6d={'raw':!![],'where':{'id':_0x5ad47a[_0xf7f2('0x58')]['id']}},_0x3e02e3={};_0x3e02e3[_0xf7f2('0x43')]=_[_0xf7f2('0x59')](db[_0xf7f2('0x3e')]['rawAttributes']);_0x3e02e3[_0xf7f2('0x44')]=_[_0xf7f2('0x59')](_0x5ad47a[_0xf7f2('0x44')]);_0x3e02e3[_0xf7f2('0x45')]=_[_0xf7f2('0x5a')](_0x3e02e3[_0xf7f2('0x43')],_0x3e02e3[_0xf7f2('0x44')]);_0xd58e6d['attributes']=_[_0xf7f2('0x5a')](_0x3e02e3[_0xf7f2('0x43')],qs[_0xf7f2('0x47')](_0x5ad47a[_0xf7f2('0x44')]['fields']));_0xd58e6d[_0xf7f2('0x46')]=_0xd58e6d[_0xf7f2('0x46')][_0xf7f2('0x48')]?_0xd58e6d['attributes']:_0x3e02e3[_0xf7f2('0x43')];if(_0x5ad47a[_0xf7f2('0x44')]['includeAll']){_0xd58e6d[_0xf7f2('0x55')]=[{'all':!![]}];}_0xd58e6d=_['merge']({},_0xd58e6d,_0x5ad47a[_0xf7f2('0x52')]);return db[_0xf7f2('0x3e')]['find'](_0xd58e6d)[_0xf7f2('0x22')](handleEntityNotFound(_0x6d7eb,null))[_0xf7f2('0x22')](respondWithResult(_0x6d7eb,null))[_0xf7f2('0x2b')](handleError(_0x6d7eb,null));};exports[_0xf7f2('0x5b')]=function(_0x12aad6,_0x2ed270){return db['OpenchannelMessage'][_0xf7f2('0x5b')](_0x12aad6['body'],{})[_0xf7f2('0x22')](respondWithResult(_0x2ed270,0xc9))[_0xf7f2('0x2b')](handleError(_0x2ed270,null));};exports['update']=function(_0x28aa4a,_0x5ead27){if(_0x28aa4a['body']['id']){delete _0x28aa4a[_0xf7f2('0x5c')]['id'];}return db[_0xf7f2('0x3e')][_0xf7f2('0x5d')]({'where':{'id':_0x28aa4a[_0xf7f2('0x58')]['id']}})[_0xf7f2('0x22')](handleEntityNotFound(_0x5ead27,null))[_0xf7f2('0x22')](saveUpdates(_0x28aa4a[_0xf7f2('0x5c')],null))[_0xf7f2('0x22')](respondWithResult(_0x5ead27,null))[_0xf7f2('0x2b')](handleError(_0x5ead27,null));};exports[_0xf7f2('0x37')]=function(_0x56e5fd,_0x1b51b6){return db[_0xf7f2('0x3e')][_0xf7f2('0x5d')]({'where':{'id':_0x56e5fd[_0xf7f2('0x58')]['id']}})[_0xf7f2('0x22')](handleEntityNotFound(_0x1b51b6,null))['then'](removeEntity(_0x1b51b6,null))[_0xf7f2('0x2b')](handleError(_0x1b51b6,null));};exports['describe']=function(_0x344727,_0x6289eb){return db[_0xf7f2('0x3e')]['describe']()['then'](respondWithResult(_0x6289eb,null))[_0xf7f2('0x2b')](handleError(_0x6289eb,null));};var interaction_log=require(_0xf7f2('0x14'))(_0xf7f2('0x5e'));exports[_0xf7f2('0x5f')]=function(_0x5e1092,_0x3720e8,_0x12aa50){var _0x55d63c={'agent':{},'channel':_0xf7f2('0x60')};if(_0x5e1092[_0xf7f2('0x5c')]['id']){delete _0x5e1092['body']['id'];}_0x5e1092[_0xf7f2('0x5c')][_0xf7f2('0x61')]=!![];_0x5e1092[_0xf7f2('0x5c')][_0xf7f2('0x62')]=moment()[_0xf7f2('0x63')](_0xf7f2('0x64'));_0x5e1092[_0xf7f2('0x5c')][_0xf7f2('0x65')]=_0x5e1092[_0xf7f2('0x5c')]['UserId']||_0x5e1092['user']['id'];_0x55d63c[_0xf7f2('0x66')]['id']=_0x5e1092[_0xf7f2('0x5c')][_0xf7f2('0x65')];return db[_0xf7f2('0x3e')]['find']({'where':{'id':_0x5e1092[_0xf7f2('0x58')]['id'],'UserId':null}})[_0xf7f2('0x22')](handleEntityNotFound(_0x3720e8,null))[_0xf7f2('0x22')](saveUpdates(_0x5e1092['body'],null))[_0xf7f2('0x22')](function(_0x16dd83){if(_0x16dd83){_0x55d63c[_0xf7f2('0x28')]=_0x16dd83['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x16dd83['OpenchannelInteractionId']}});}return null;})[_0xf7f2('0x22')](handleEntityNotFound(_0x3720e8,null))[_0xf7f2('0x22')](function(_0x3c7209){if(_0x3c7209){return _0x3c7209[_0xf7f2('0x36')]({'UserId':_0x5e1092[_0xf7f2('0x5c')][_0xf7f2('0x65')],'read1stAt':_['isNil'](_0x3c7209[_0xf7f2('0x67')])?moment()[_0xf7f2('0x63')](_0xf7f2('0x64')):undefined});}return null;})['then'](function(_0x12208e){if(_0x12208e){_0x55d63c['interaction']=_0x12208e['get']({'plain':!![]});interaction_log[_0xf7f2('0x29')](_0xf7f2('0x68'),_0x5e1092['user']['id'],_0x5e1092[_0xf7f2('0x69')]['name'],_0x5e1092[_0xf7f2('0x69')][_0xf7f2('0x6a')],_0x55d63c['interaction']['id'],_0x5e1092['body']?JSON[_0xf7f2('0x6b')](_0x5e1092[_0xf7f2('0x5c')]):_0xf7f2('0x6c'));return respondWithRpcPromise(_0xf7f2('0x6d'),_0xf7f2('0x6e'),_0x55d63c);}return null;})[_0xf7f2('0x22')](function(_0x497500){var _0x49b533='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x497500[_0xf7f2('0x28')]['ContactId'];return db[_0xf7f2('0x6f')]['query'](_0x49b533,{'type':db[_0xf7f2('0x70')][_0xf7f2('0x71')]['SELECT'],'raw':!![]})[_0xf7f2('0x22')](function(_0xfff1b4){return _0xfff1b4;});})[_0xf7f2('0x22')](function(_0x7142de){if(_0x7142de){_0x55d63c['message']['contact']=_0x7142de[0x0];if(!_0x5e1092[_0xf7f2('0x5c')]['UserId'])return;return db[_0xf7f2('0x72')][_0xf7f2('0x5d')]({'where':{'id':_0x5e1092[_0xf7f2('0x5c')][_0xf7f2('0x65')],'role':_0xf7f2('0x66')},'attributes':['id',_0xf7f2('0x3a'),_0xf7f2('0x73'),_0xf7f2('0x74'),'internal'],'raw':!![]});}return null;})[_0xf7f2('0x22')](function(_0x20be1c){if(!_0x20be1c)return null;_0x55d63c[_0xf7f2('0x28')]['agent']=_0x20be1c;return _0x55d63c;})[_0xf7f2('0x22')](function(_0xe48f37){if(_0xe48f37){if(_0x5e1092[_0xf7f2('0x5c')][_0xf7f2('0x75')]){_0x55d63c[_0xf7f2('0x28')][_0xf7f2('0x76')]=util[_0xf7f2('0x63')](_0xf7f2('0x77'),_0x5e1092[_0xf7f2('0x69')][_0xf7f2('0x3a')]);_0x55d63c['message']['channel']=_0x55d63c[_0xf7f2('0x78')];_0x55d63c[_0xf7f2('0x28')]['motionChannel']=_0x55d63c[_0xf7f2('0x78')];_0x55d63c[_0xf7f2('0x28')][_0xf7f2('0x79')]=_0xf7f2('0x5f');return respondWithRpcPromise(_0xf7f2('0x7a'),_0xf7f2('0x7a'),{'event':_0xf7f2('0x7b'),'message':_0x55d63c[_0xf7f2('0x28')]},client9002)[_0xf7f2('0x22')](function(){return _0x55d63c;});}return _0x55d63c;}return null;})[_0xf7f2('0x22')](respondWithResult(_0x3720e8,null))['catch'](handleError(_0x3720e8,null));};var interaction_log=require(_0xf7f2('0x14'))('openchannel-interactions');exports[_0xf7f2('0x34')]=function(_0x507163,_0xe373f4,_0x53c7f8){var _0xe5e53f={'agent':{},'channel':'openchannel'};if(_0x507163[_0xf7f2('0x5c')]['id']){delete _0x507163[_0xf7f2('0x5c')]['id'];}_0x507163['body'][_0xf7f2('0x65')]=_0x507163[_0xf7f2('0x5c')][_0xf7f2('0x65')]||_0x507163['user']['id'];_0xe5e53f[_0xf7f2('0x66')]['id']=_0x507163[_0xf7f2('0x5c')]['UserId'];return db[_0xf7f2('0x3e')][_0xf7f2('0x5d')]({'where':{'id':_0x507163['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xe373f4,null))[_0xf7f2('0x22')](function(_0x21beb8){if(_0x21beb8){_0xe5e53f['message']=_0x21beb8[_0xf7f2('0x7c')]({'plain':!![]});return db[_0xf7f2('0x7d')][_0xf7f2('0x5d')]({'where':{'id':_0x21beb8['OpenchannelInteractionId']}});}return null;})[_0xf7f2('0x22')](handleEntityNotFound(_0xe373f4,null))[_0xf7f2('0x22')](function(_0x1503d4){if(_0x1503d4){_0xe5e53f['interaction']=_0x1503d4[_0xf7f2('0x7c')]({'plain':!![]});interaction_log[_0xf7f2('0x29')](_0xf7f2('0x7e'),_0x507163[_0xf7f2('0x69')]['id'],_0x507163['user']['name'],_0x507163['user'][_0xf7f2('0x6a')],_0xe5e53f[_0xf7f2('0x7f')]['id'],_0x507163[_0xf7f2('0x5c')]?JSON[_0xf7f2('0x6b')](_0x507163[_0xf7f2('0x5c')]):_0xf7f2('0x6c'));return respondWithRpcPromise('RejectMessage',_0xf7f2('0x80'),_0xe5e53f);}return null;})[_0xf7f2('0x22')](function(_0x42ce21){var _0x424bb1=_0xf7f2('0x81')+_0x42ce21[_0xf7f2('0x28')][_0xf7f2('0x82')];return db['sequelize'][_0xf7f2('0x44')](_0x424bb1,{'type':db[_0xf7f2('0x70')][_0xf7f2('0x71')][_0xf7f2('0x83')],'raw':!![]})['then'](function(_0x29fc6b){return _0x29fc6b;});})['then'](function(_0x17584e){if(_0x17584e){_0xe5e53f['message'][_0xf7f2('0x84')]=_0x17584e[0x0];if(!_0x507163[_0xf7f2('0x5c')][_0xf7f2('0x65')])return;return db[_0xf7f2('0x72')][_0xf7f2('0x5d')]({'where':{'id':_0x507163[_0xf7f2('0x5c')][_0xf7f2('0x65')],'role':_0xf7f2('0x66')},'attributes':['id','name',_0xf7f2('0x73'),_0xf7f2('0x74'),_0xf7f2('0x85')],'raw':!![]});}return null;})['then'](function(_0x5d5060){if(!_0x5d5060)return null;_0xe5e53f[_0xf7f2('0x28')][_0xf7f2('0x66')]=_0x5d5060;return _0xe5e53f;})[_0xf7f2('0x22')](function(_0x32b66a){if(_0x32b66a){_0x32b66a[_0xf7f2('0x28')][_0xf7f2('0x76')]=util[_0xf7f2('0x63')](_0xf7f2('0x77'),_0x507163[_0xf7f2('0x69')]['name']);_0x32b66a[_0xf7f2('0x28')][_0xf7f2('0x78')]=_0xe5e53f['channel'];_0x32b66a[_0xf7f2('0x28')][_0xf7f2('0x86')]=_0xe5e53f['channel'];_0x32b66a[_0xf7f2('0x28')][_0xf7f2('0x79')]=_0xf7f2('0x34');respondWithRpcPromise(_0xf7f2('0x7a'),_0xf7f2('0x7a'),{'event':_0xf7f2('0x87'),'message':_0x32b66a[_0xf7f2('0x28')]},client9002);return _0xe5e53f;}return null;})[_0xf7f2('0x22')](respondWithResult(_0xe373f4,null))['catch'](handleError(_0xe373f4,null));};