Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / api / cmHopperFinal / cmHopperFinal.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 _0xa7cf=['path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','length','describe','body','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','ContactId','ListId','VoiceQueueId','updatedAt','select','field','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','createdAt','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum','checkContactHopper','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x2be702,_0x474aeb){var _0x38b38f=function(_0x1dbdfa){while(--_0x1dbdfa){_0x2be702['push'](_0x2be702['shift']());}};_0x38b38f(++_0x474aeb);}(_0xa7cf,0x7b));var _0xfa7c=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xa7cf[_0x4b7895];return _0x264180;};'use strict';var emlformat=require(_0xfa7c('0x0'));var rimraf=require(_0xfa7c('0x1'));var zipdir=require(_0xfa7c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa7c('0x3'));var moment=require(_0xfa7c('0x4'));var BPromise=require(_0xfa7c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfa7c('0x6'));var sox=require(_0xfa7c('0x7'));var csv=require(_0xfa7c('0x8'));var ejs=require(_0xfa7c('0x9'));var fs=require('fs');var fs_extra=require(_0xfa7c('0xa'));var _=require(_0xfa7c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfa7c('0xc'));var deskjs=require(_0xfa7c('0xd'));var toCsv=require(_0xfa7c('0x8'));var querystring=require(_0xfa7c('0xe'));var Papa=require(_0xfa7c('0xf'));var Redis=require(_0xfa7c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfa7c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa7c('0x12'));var logger=require(_0xfa7c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xfa7c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfa7c('0x15'))['db'];function respondWithStatusCode(_0x3420af,_0x4a3488){_0x4a3488=_0x4a3488||0xcc;return function(_0x357c7b){if(_0x357c7b){return _0x3420af[_0xfa7c('0x16')](_0x4a3488);}return _0x3420af[_0xfa7c('0x17')](_0x4a3488)['end']();};}function respondWithResult(_0x12a2ab,_0x5166c5){_0x5166c5=_0x5166c5||0xc8;return function(_0x535d45){if(_0x535d45){return _0x12a2ab['status'](_0x5166c5)[_0xfa7c('0x18')](_0x535d45);}};}function respondWithFilteredResult(_0x3b3886,_0xa9f784){return function(_0x5949d5){if(_0x5949d5){var _0x2d9ae3=typeof _0xa9f784[_0xfa7c('0x19')]===_0xfa7c('0x1a')&&typeof _0xa9f784['limit']===_0xfa7c('0x1a');var _0x4d40f5=_0x5949d5[_0xfa7c('0x1b')];var _0x12c5d9=_0x2d9ae3?0x0:_0xa9f784[_0xfa7c('0x19')];var _0x5cbccf=_0x2d9ae3?_0x5949d5['count']:_0xa9f784[_0xfa7c('0x19')]+_0xa9f784[_0xfa7c('0x1c')];var _0x2daed9;if(_0x5cbccf>=_0x4d40f5){_0x5cbccf=_0x4d40f5;_0x2daed9=0xc8;}else{_0x2daed9=0xce;}_0x3b3886[_0xfa7c('0x17')](_0x2daed9);return _0x3b3886[_0xfa7c('0x1d')](_0xfa7c('0x1e'),_0x12c5d9+'-'+_0x5cbccf+'/'+_0x4d40f5)[_0xfa7c('0x18')](_0x5949d5);}return null;};}function patchUpdates(_0xeddf89){return function(_0x532e17){try{jsonpatch[_0xfa7c('0x1f')](_0x532e17,_0xeddf89,!![]);}catch(_0xf64b65){return BPromise[_0xfa7c('0x20')](_0xf64b65);}return _0x532e17[_0xfa7c('0x21')]();};}function saveUpdates(_0x43b711,_0xe0d135){return function(_0x2ffc54){if(_0x2ffc54){return _0x2ffc54[_0xfa7c('0x22')](_0x43b711)['then'](function(_0x47adec){return _0x47adec;});}return null;};}function removeEntity(_0x5da0fd,_0x137e69){return function(_0x5799d3){if(_0x5799d3){return _0x5799d3[_0xfa7c('0x23')]()[_0xfa7c('0x24')](function(){_0x5da0fd[_0xfa7c('0x17')](0xcc)[_0xfa7c('0x25')]();});}};}function handleEntityNotFound(_0x381364,_0x4632a7){return function(_0x5dc3b1){if(!_0x5dc3b1){_0x381364[_0xfa7c('0x16')](0x194);}return _0x5dc3b1;};}function handleError(_0x56b3d1,_0x5a6178){_0x5a6178=_0x5a6178||0x1f4;return function(_0x37d1ce){logger[_0xfa7c('0x26')](_0x37d1ce[_0xfa7c('0x27')]);if(_0x37d1ce[_0xfa7c('0x28')]){delete _0x37d1ce['name'];}_0x56b3d1[_0xfa7c('0x17')](_0x5a6178)['send'](_0x37d1ce);};}exports[_0xfa7c('0x29')]=function(_0xefc360,_0x4a8b37){var _0x44c4e9={},_0x7a6147={},_0x140639={'count':0x0,'rows':[]};var _0x255517=_[_0xfa7c('0x2a')](db[_0xfa7c('0x2b')][_0xfa7c('0x2c')],function(_0x398738){return{'name':_0x398738[_0xfa7c('0x2d')],'type':_0x398738[_0xfa7c('0x2e')][_0xfa7c('0x2f')]};});_0x7a6147[_0xfa7c('0x30')]=_[_0xfa7c('0x2a')](_0x255517,_0xfa7c('0x28'));_0x7a6147[_0xfa7c('0x31')]=_[_0xfa7c('0x32')](_0xefc360['query']);_0x7a6147[_0xfa7c('0x33')]=_[_0xfa7c('0x34')](_0x7a6147['model'],_0x7a6147[_0xfa7c('0x31')]);_0x44c4e9[_0xfa7c('0x35')]=_[_0xfa7c('0x34')](_0x7a6147['model'],qs[_0xfa7c('0x36')](_0xefc360[_0xfa7c('0x31')][_0xfa7c('0x36')]));_0x44c4e9['attributes']=_0x44c4e9[_0xfa7c('0x35')]['length']?_0x44c4e9[_0xfa7c('0x35')]:_0x7a6147[_0xfa7c('0x30')];if(!_0xefc360[_0xfa7c('0x31')][_0xfa7c('0x37')](_0xfa7c('0x38'))){_0x44c4e9['limit']=qs[_0xfa7c('0x1c')](_0xefc360[_0xfa7c('0x31')]['limit']);_0x44c4e9[_0xfa7c('0x19')]=qs[_0xfa7c('0x19')](_0xefc360['query']['offset']);}_0x44c4e9[_0xfa7c('0x39')]=qs[_0xfa7c('0x3a')](_0xefc360[_0xfa7c('0x31')][_0xfa7c('0x3a')]);_0x44c4e9[_0xfa7c('0x3b')]=qs[_0xfa7c('0x33')](_[_0xfa7c('0x3c')](_0xefc360[_0xfa7c('0x31')],_0x7a6147['filters']),_0x255517);if(_0xefc360[_0xfa7c('0x31')]['filter']){_0x44c4e9['where']=_['merge'](_0x44c4e9['where'],{'$or':_['map'](_0x255517,function(_0x4b2d6f){if(_0x4b2d6f[_0xfa7c('0x2e')]!=='VIRTUAL'){var _0x331cf4={};_0x331cf4[_0x4b2d6f[_0xfa7c('0x28')]]={'$like':'%'+_0xefc360[_0xfa7c('0x31')][_0xfa7c('0x3d')]+'%'};return _0x331cf4;}})});}_0x44c4e9=_[_0xfa7c('0x3e')]({},_0x44c4e9,_0xefc360[_0xfa7c('0x3f')]);var _0x257f8d={'where':_0x44c4e9['where']};return db[_0xfa7c('0x2b')][_0xfa7c('0x1b')](_0x257f8d)[_0xfa7c('0x24')](function(_0x12b045){_0x140639[_0xfa7c('0x1b')]=_0x12b045;if(_0xefc360[_0xfa7c('0x31')][_0xfa7c('0x40')]){_0x44c4e9[_0xfa7c('0x41')]=[{'all':!![]}];}return db[_0xfa7c('0x2b')][_0xfa7c('0x42')](_0x44c4e9);})[_0xfa7c('0x24')](function(_0x38d724){_0x140639['rows']=_0x38d724;return _0x140639;})[_0xfa7c('0x24')](respondWithFilteredResult(_0x4a8b37,_0x44c4e9))[_0xfa7c('0x43')](handleError(_0x4a8b37,null));};exports[_0xfa7c('0x44')]=function(_0x218df6,_0x1ea251){var _0x153bde={'raw':!![],'where':{'id':_0x218df6[_0xfa7c('0x45')]['id']}},_0x53f17c={};_0x53f17c[_0xfa7c('0x30')]=_[_0xfa7c('0x32')](db[_0xfa7c('0x2b')][_0xfa7c('0x2c')]);_0x53f17c[_0xfa7c('0x31')]=_['keys'](_0x218df6[_0xfa7c('0x31')]);_0x53f17c[_0xfa7c('0x33')]=_['intersection'](_0x53f17c[_0xfa7c('0x30')],_0x53f17c['query']);_0x153bde['attributes']=_[_0xfa7c('0x34')](_0x53f17c[_0xfa7c('0x30')],qs['fields'](_0x218df6[_0xfa7c('0x31')]['fields']));_0x153bde['attributes']=_0x153bde['attributes'][_0xfa7c('0x46')]?_0x153bde[_0xfa7c('0x35')]:_0x53f17c['model'];if(_0x218df6[_0xfa7c('0x31')][_0xfa7c('0x40')]){_0x153bde[_0xfa7c('0x41')]=[{'all':!![]}];}_0x153bde=_[_0xfa7c('0x3e')]({},_0x153bde,_0x218df6[_0xfa7c('0x3f')]);return db[_0xfa7c('0x2b')]['find'](_0x153bde)[_0xfa7c('0x24')](handleEntityNotFound(_0x1ea251,null))[_0xfa7c('0x24')](respondWithResult(_0x1ea251,null))[_0xfa7c('0x43')](handleError(_0x1ea251,null));};exports[_0xfa7c('0x47')]=function(_0x15e549,_0x2c3a6b){return db[_0xfa7c('0x2b')][_0xfa7c('0x47')]()['then'](respondWithResult(_0x2c3a6b,null))[_0xfa7c('0x43')](handleError(_0x2c3a6b,null));};exports['update']=function(_0x2fb74f,_0x199dd4){if(_0x2fb74f[_0xfa7c('0x48')]['uniqueid']){delete _0x2fb74f[_0xfa7c('0x48')]['uniqueid'];}return db[_0xfa7c('0x2b')][_0xfa7c('0x49')]({'where':{'uniqueid':_0x2fb74f[_0xfa7c('0x45')]['id']}})[_0xfa7c('0x24')](handleEntityNotFound(_0x199dd4,null))[_0xfa7c('0x24')](saveUpdates(_0x2fb74f[_0xfa7c('0x48')],null))[_0xfa7c('0x24')](respondWithResult(_0x199dd4,null))[_0xfa7c('0x43')](handleError(_0x199dd4,null));};exports[_0xfa7c('0x4a')]=function(_0x5e33a9,_0x1faae3,_0x283d30){return db[_0xfa7c('0x2b')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x5e33a9[_0xfa7c('0x45')]['id']},'attributes':[[db['sequelize']['fn'](_0xfa7c('0x4b'),db[_0xfa7c('0x4c')]['fn']('IF',db[_0xfa7c('0x4c')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xfa7c('0x4d')],[db[_0xfa7c('0x4c')]['fn'](_0xfa7c('0x4b'),db[_0xfa7c('0x4c')]['fn']('IF',db[_0xfa7c('0x4c')][_0xfa7c('0x4e')](_0xfa7c('0x4f')))),_0xfa7c('0x50')],[db[_0xfa7c('0x4c')]['fn'](_0xfa7c('0x4b'),db[_0xfa7c('0x4c')]['fn']('IF',db[_0xfa7c('0x4c')][_0xfa7c('0x4e')](_0xfa7c('0x51')))),_0xfa7c('0x52')],[db[_0xfa7c('0x4c')]['fn'](_0xfa7c('0x4b'),db[_0xfa7c('0x4c')]['fn']('IF',db['sequelize'][_0xfa7c('0x4e')](_0xfa7c('0x53')))),_0xfa7c('0x54')],[db[_0xfa7c('0x4c')]['fn'](_0xfa7c('0x4b'),db[_0xfa7c('0x4c')]['fn']('IF',db[_0xfa7c('0x4c')]['literal'](_0xfa7c('0x55')))),_0xfa7c('0x56')],[db[_0xfa7c('0x4c')]['fn'](_0xfa7c('0x4b'),db[_0xfa7c('0x4c')]['fn']('IF',db[_0xfa7c('0x4c')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xfa7c('0x57')],[db[_0xfa7c('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xfa7c('0x4c')][_0xfa7c('0x4e')](_0xfa7c('0x58')))),_0xfa7c('0x59')],[db['sequelize']['fn'](_0xfa7c('0x4b'),db[_0xfa7c('0x4c')]['fn']('IF',db['sequelize'][_0xfa7c('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xfa7c('0x24')](handleEntityNotFound(_0x1faae3,null))[_0xfa7c('0x24')](respondWithResult(_0x1faae3,null))[_0xfa7c('0x43')](handleError(_0x1faae3,null));};exports[_0xfa7c('0x5a')]=function(_0xb6795d,_0x4ef214,_0x7ccceb){return db[_0xfa7c('0x2b')]['findAll']({'raw':![],'where':{'CampaignId':_0xb6795d[_0xfa7c('0x45')]['id']},'attributes':[[db['sequelize']['fn'](_0xfa7c('0x4b'),db[_0xfa7c('0x4c')]['fn']('IF',db['sequelize'][_0xfa7c('0x4e')](_0xfa7c('0x5b')))),'noSuchContacts'],[db[_0xfa7c('0x4c')]['fn'](_0xfa7c('0x4b'),db[_0xfa7c('0x4c')]['fn']('IF',db[_0xfa7c('0x4c')][_0xfa7c('0x4e')](_0xfa7c('0x4f')))),_0xfa7c('0x50')],[db[_0xfa7c('0x4c')]['fn'](_0xfa7c('0x4b'),db[_0xfa7c('0x4c')]['fn']('IF',db['sequelize']['literal'](_0xfa7c('0x51')))),_0xfa7c('0x52')],[db['sequelize']['fn'](_0xfa7c('0x4b'),db[_0xfa7c('0x4c')]['fn']('IF',db['sequelize'][_0xfa7c('0x4e')](_0xfa7c('0x53')))),'congestionContacts'],[db[_0xfa7c('0x4c')]['fn']('COUNT',db[_0xfa7c('0x4c')]['fn']('IF',db['sequelize'][_0xfa7c('0x4e')](_0xfa7c('0x55')))),_0xfa7c('0x56')],[db[_0xfa7c('0x4c')]['fn'](_0xfa7c('0x4b'),db['sequelize']['fn']('IF',db[_0xfa7c('0x4c')][_0xfa7c('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0xfa7c('0x4c')]['fn'](_0xfa7c('0x4b'),db[_0xfa7c('0x4c')]['fn']('IF',db[_0xfa7c('0x4c')][_0xfa7c('0x4e')](_0xfa7c('0x58')))),_0xfa7c('0x59')],[db['sequelize']['fn'](_0xfa7c('0x4b'),db[_0xfa7c('0x4c')]['fn']('IF',db[_0xfa7c('0x4c')]['literal'](_0xfa7c('0x5c')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x4ef214,null))[_0xfa7c('0x24')](respondWithResult(_0x4ef214,null))[_0xfa7c('0x43')](handleError(_0x4ef214,null));};exports[_0xfa7c('0x5d')]=function(_0x5b39fc,_0x59eac1,_0x23bff7){return db[_0xfa7c('0x5e')][_0xfa7c('0x49')]({'where':{'id':_0x5b39fc[_0xfa7c('0x45')]['id']}})['then'](handleEntityNotFound(_0x59eac1,null))[_0xfa7c('0x24')](function(_0x303a2c){var _0x29a23c;if(_0x303a2c){_0x29a23c=squel['insert']()[_0xfa7c('0x5f')](_0xfa7c('0x60'))[_0xfa7c('0x61')](['phone','scheduledAt',_0xfa7c('0x62'),_0xfa7c('0x63'),_0xfa7c('0x64'),'createdAt',_0xfa7c('0x65')],squel[_0xfa7c('0x66')]()[_0xfa7c('0x67')]('ANY_VALUE(calleridnum)',_0xfa7c('0x68'))['field'](_0xfa7c('0x69'),_0xfa7c('0x6a'))[_0xfa7c('0x67')](_0xfa7c('0x6b'),'ContactId')[_0xfa7c('0x67')]('ANY_VALUE(ListId)',_0xfa7c('0x63'))['field'](_0xfa7c('0x6c'),'VoiceQueueId')[_0xfa7c('0x67')](_0xfa7c('0x69'),_0xfa7c('0x6d'))[_0xfa7c('0x67')]('NOW()',_0xfa7c('0x65'))['from']('cm_hopper_final')[_0xfa7c('0x3b')](_0xfa7c('0x6e'),_0x5b39fc[_0xfa7c('0x45')]['id'][_0xfa7c('0x6f')]())['where']('state\x20=\x20?',_0x5b39fc[_0xfa7c('0x48')][_0xfa7c('0x70')][_0xfa7c('0x6f')]())[_0xfa7c('0x3b')](_0xfa7c('0x71'))[_0xfa7c('0x3b')](_0xfa7c('0x72'),squel[_0xfa7c('0x66')]()[_0xfa7c('0x67')](_0xfa7c('0x68'))[_0xfa7c('0x73')](_0xfa7c('0x60'))[_0xfa7c('0x3b')](_0xfa7c('0x6e'),_0x5b39fc[_0xfa7c('0x45')]['id'][_0xfa7c('0x6f')]()))[_0xfa7c('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xfa7c('0x66')]()[_0xfa7c('0x67')]('calleridnum')[_0xfa7c('0x73')](_0xfa7c('0x74'))[_0xfa7c('0x3b')](_0xfa7c('0x6e'),_0x5b39fc[_0xfa7c('0x45')]['id'][_0xfa7c('0x6f')]())[_0xfa7c('0x3b')](_0xfa7c('0x75')))[_0xfa7c('0x76')](_0xfa7c('0x62')))[_0xfa7c('0x6f')]();return db[_0xfa7c('0x4c')]['query'](_0x29a23c);}return[];})[_0xfa7c('0x24')](respondWithResult(_0x59eac1,null))[_0xfa7c('0x43')](handleError(_0x59eac1,null));};exports[_0xfa7c('0x77')]=function(_0x128bad,_0x62dcdf,_0x1f67fa){return db[_0xfa7c('0x78')]['find']({'where':{'id':_0x128bad['params']['id']}})[_0xfa7c('0x24')](handleEntityNotFound(_0x62dcdf,null))[_0xfa7c('0x24')](function(_0xe3ad2){var _0x3b9230;if(_0xe3ad2){_0x3b9230=squel['insert']()[_0xfa7c('0x5f')]('cm_hopper')[_0xfa7c('0x61')]([_0xfa7c('0x68'),_0xfa7c('0x6a'),_0xfa7c('0x62'),_0xfa7c('0x63'),'CampaignId',_0xfa7c('0x6d'),_0xfa7c('0x65')],squel[_0xfa7c('0x66')]()['field']('ANY_VALUE(calleridnum)',_0xfa7c('0x68'))[_0xfa7c('0x67')]('NOW()',_0xfa7c('0x6a'))[_0xfa7c('0x67')](_0xfa7c('0x6b'),_0xfa7c('0x62'))[_0xfa7c('0x67')](_0xfa7c('0x79'),_0xfa7c('0x63'))['field'](_0xfa7c('0x7a'),_0xfa7c('0x7b'))[_0xfa7c('0x67')](_0xfa7c('0x69'),'createdAt')['field']('NOW()',_0xfa7c('0x65'))[_0xfa7c('0x73')](_0xfa7c('0x74'))[_0xfa7c('0x3b')](_0xfa7c('0x7c'),_0x128bad[_0xfa7c('0x45')]['id'][_0xfa7c('0x6f')]())['where'](_0xfa7c('0x7d'),_0x128bad[_0xfa7c('0x48')][_0xfa7c('0x70')][_0xfa7c('0x6f')]())[_0xfa7c('0x3b')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xfa7c('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xfa7c('0x66')]()[_0xfa7c('0x67')]('phone')[_0xfa7c('0x73')]('cm_hopper')[_0xfa7c('0x3b')](_0xfa7c('0x7c'),_0x128bad[_0xfa7c('0x45')]['id'][_0xfa7c('0x6f')]()))[_0xfa7c('0x3b')](_0xfa7c('0x72'),squel[_0xfa7c('0x66')]()['field'](_0xfa7c('0x7e'))[_0xfa7c('0x73')]('cm_hopper_final')[_0xfa7c('0x3b')](_0xfa7c('0x7c'),_0x128bad[_0xfa7c('0x45')]['id'][_0xfa7c('0x6f')]())[_0xfa7c('0x3b')](_0xfa7c('0x75')))[_0xfa7c('0x76')](_0xfa7c('0x62')))[_0xfa7c('0x6f')]();return db['sequelize'][_0xfa7c('0x31')](_0x3b9230);}return[];})[_0xfa7c('0x24')](respondWithResult(_0x62dcdf,null))[_0xfa7c('0x43')](handleError(_0x62dcdf,null));};exports[_0xfa7c('0x7f')]=function(_0x3bead4,_0x1aaa59,_0x332b66){return db['CmHopper'][_0xfa7c('0x80')]({'where':{'VoiceQueueId':_0x3bead4[_0xfa7c('0x48')][_0xfa7c('0x64')],'CampaignId':_0x3bead4[_0xfa7c('0x48')][_0xfa7c('0x7b')],'ContactId':_0x3bead4[_0xfa7c('0x48')][_0xfa7c('0x62')]}})[_0xfa7c('0x24')](handleEntityNotFound(_0x1aaa59,null))[_0xfa7c('0x24')](function(_0x122f11){if(_0x122f11){return _0x122f11;}return null;})[_0xfa7c('0x24')](respondWithResult(_0x1aaa59,null))[_0xfa7c('0x43')](handleError(_0x1aaa59,null));};