489da651fcca66f21eff7e7438c55fe93d97e04f
[motion2.git] / server / api / cmHopper / cmHopper.rpc.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 _0x31b9=['GetCmHopperPreview','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','List','CmHopperHandlePreviewRecallNotifications','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','stringify','error','message','ShowCmHopper','catch','CreateCmHopper','create','body','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','order','LOCK','UPDATE','Contact','keys','Agent','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','CmContact','describe'];(function(_0x141295,_0xb221c9){var _0x18753b=function(_0x68ad6e){while(--_0x68ad6e){_0x141295['push'](_0x141295['shift']());}};_0x18753b(++_0xb221c9);}(_0x31b9,0xb4));var _0x931b=function(_0x46d58d,_0x157397){_0x46d58d=_0x46d58d-0x0;var _0x3e1f10=_0x31b9[_0x46d58d];return _0x3e1f10;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x931b('0x0'));var BPromise=require(_0x931b('0x1'));var db=require(_0x931b('0x2'))['db'];var logger=require(_0x931b('0x3'))(_0x931b('0x4'));exports[_0x931b('0x5')]=function(_0x4e9c87){var _0x402c2f=this;return new Promise(function(_0x29953a,_0x5e1c5d){return db[_0x931b('0x6')][_0x931b('0x7')]({'raw':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![],'where':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87['options'][_0x931b('0xa')]||null:null,'attributes':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87[_0x931b('0x8')]['attributes']||null:null,'limit':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87['options'][_0x931b('0xb')]||null:null,'include':_0x4e9c87[_0x931b('0x8')]?_0x4e9c87[_0x931b('0x8')][_0x931b('0xc')]?_[_0x931b('0xd')](_0x4e9c87[_0x931b('0x8')][_0x931b('0xc')],function(_0x2318e5){return{'model':db[_0x2318e5[_0x931b('0xe')]],'as':_0x2318e5['as'],'attributes':_0x2318e5[_0x931b('0xf')],'include':_0x2318e5[_0x931b('0xc')]?_[_0x931b('0xd')](_0x2318e5[_0x931b('0xc')],function(_0x4b7f06){return{'model':db[_0x4b7f06['model']],'as':_0x4b7f06['as'],'attributes':_0x4b7f06['attributes'],'include':_0x4b7f06[_0x931b('0xc')]?_['map'](_0x4b7f06[_0x931b('0xc')],function(_0x45b0c7){return{'model':db[_0x45b0c7['model']],'as':_0x45b0c7['as'],'attributes':_0x45b0c7[_0x931b('0xf')]};}):[]};}):[]};}):[]:[]})[_0x931b('0x10')](function(_0x19c35b){logger[_0x931b('0x11')](_0x931b('0x5'),_0x4e9c87);logger[_0x931b('0x12')]('GetCmHopper',_0x4e9c87,JSON[_0x931b('0x13')](_0x19c35b));_0x29953a(_0x19c35b);})['catch'](function(_0x4bdead){logger[_0x931b('0x14')]('GetCmHopper',_0x4bdead[_0x931b('0x15')],_0x4e9c87);_0x5e1c5d(_0x402c2f[_0x931b('0x14')](0x1f4,_0x4bdead[_0x931b('0x15')]));});});};exports[_0x931b('0x16')]=function(_0x448c20){var _0x4b0858=this;return new Promise(function(_0x5a4042,_0x58e33d){return db[_0x931b('0x6')]['find']({'raw':_0x448c20['options']?_0x448c20[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![],'where':_0x448c20[_0x931b('0x8')]?_0x448c20[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':_0x448c20[_0x931b('0x8')]?_0x448c20['options']['attributes']||null:null,'include':_0x448c20['options']?_0x448c20['options'][_0x931b('0xc')]?_[_0x931b('0xd')](_0x448c20[_0x931b('0x8')][_0x931b('0xc')],function(_0x35638e){return{'model':db[_0x35638e[_0x931b('0xe')]],'as':_0x35638e['as'],'attributes':_0x35638e[_0x931b('0xf')],'include':_0x35638e[_0x931b('0xc')]?_[_0x931b('0xd')](_0x35638e[_0x931b('0xc')],function(_0xb16da6){return{'model':db[_0xb16da6['model']],'as':_0xb16da6['as'],'attributes':_0xb16da6['attributes'],'include':_0xb16da6[_0x931b('0xc')]?_['map'](_0xb16da6[_0x931b('0xc')],function(_0x1b9d09){return{'model':db[_0x1b9d09[_0x931b('0xe')]],'as':_0x1b9d09['as'],'attributes':_0x1b9d09[_0x931b('0xf')]};}):[]};}):[]};}):[]:[]})[_0x931b('0x10')](function(_0x5f44df){logger[_0x931b('0x11')](_0x931b('0x16'),_0x448c20);logger[_0x931b('0x12')]('ShowCmHopper',_0x448c20,JSON['stringify'](_0x5f44df));_0x5a4042(_0x5f44df);})[_0x931b('0x17')](function(_0x2ee978){logger['error'](_0x931b('0x16'),_0x2ee978[_0x931b('0x15')],_0x448c20);_0x58e33d(_0x4b0858[_0x931b('0x14')](0x1f4,_0x2ee978[_0x931b('0x15')]));});});};exports[_0x931b('0x18')]=function(_0x2176e8){var _0x4e1da9=this;return new Promise(function(_0x197219,_0xaafbf){return db[_0x931b('0x6')][_0x931b('0x19')](_0x2176e8[_0x931b('0x1a')],{'raw':_0x2176e8[_0x931b('0x8')]?_0x2176e8[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x370648){logger['info'](_0x931b('0x18'),_0x2176e8);logger[_0x931b('0x12')](_0x931b('0x18'),_0x2176e8,JSON[_0x931b('0x13')](_0x370648));_0x197219(_0x370648);})[_0x931b('0x17')](function(_0x1c1fbe){logger[_0x931b('0x14')](_0x931b('0x18'),_0x1c1fbe[_0x931b('0x15')],_0x2176e8);_0xaafbf(_0x4e1da9[_0x931b('0x14')](0x1f4,_0x1c1fbe[_0x931b('0x15')]));});});};exports['UpdateCmHopper']=function(_0x401e5c){var _0x35bff5=this;return new Promise(function(_0x33630f,_0x2bf3c3){return db['CmHopper'][_0x931b('0x1b')](_0x401e5c[_0x931b('0x1a')],{'raw':_0x401e5c[_0x931b('0x8')]?_0x401e5c[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x401e5c[_0x931b('0x8')]?_0x401e5c[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':_0x401e5c['options']?_0x401e5c['options'][_0x931b('0xf')]||null:null,'limit':_0x401e5c['options']?_0x401e5c[_0x931b('0x8')]['limit']||null:null})[_0x931b('0x10')](function(_0x52bfbc){logger[_0x931b('0x11')](_0x931b('0x1c'),_0x401e5c);logger[_0x931b('0x11')](_0x931b('0x1d'),JSON[_0x931b('0x13')](_0x401e5c['options'][_0x931b('0xa')]),_0x401e5c['body'][_0x931b('0x1e')]);logger[_0x931b('0x12')](_0x931b('0x1c'),_0x401e5c,JSON[_0x931b('0x13')](_0x52bfbc));_0x33630f(_0x52bfbc);})['catch'](function(_0x2f8398){logger['error'](_0x931b('0x1c'),_0x2f8398[_0x931b('0x15')],_0x401e5c);_0x2bf3c3(_0x35bff5[_0x931b('0x14')](0x1f4,_0x2f8398['message']));});});};exports[_0x931b('0x1f')]=function(_0x1f9d21){var _0x261391=this;return new Promise(function(_0xf321b9,_0x558021){return db[_0x931b('0x6')][_0x931b('0x20')]({'where':_0x1f9d21['options']?_0x1f9d21[_0x931b('0x8')][_0x931b('0xa')]||null:null})[_0x931b('0x10')](function(_0x3713dc){logger[_0x931b('0x11')](_0x931b('0x1f'),_0x1f9d21);logger[_0x931b('0x12')](_0x931b('0x1f'),_0x1f9d21,JSON[_0x931b('0x13')](_0x3713dc));_0xf321b9(_0x3713dc);})[_0x931b('0x17')](function(_0x5a89e0){logger['error']('DestroyCmHopper',_0x5a89e0[_0x931b('0x15')],_0x1f9d21);_0x558021(_0x261391[_0x931b('0x14')](0x1f4,_0x5a89e0[_0x931b('0x15')]));});});};exports[_0x931b('0x21')]=function(_0xb37ea4){var _0x37e1a9=this;return new Promise(function(_0x2abd78,_0x299225){return db['CmContact']['describe']()[_0x931b('0x10')](function(_0x49c36e){return db['sequelize']['transaction'](function(_0x18182){return db[_0x931b('0x6')][_0x931b('0x7')]({'where':_0xb37ea4[_0x931b('0x8')]?_0xb37ea4[_0x931b('0x8')]['where']||null:null,'attributes':_0xb37ea4[_0x931b('0x8')]?_0xb37ea4[_0x931b('0x8')][_0x931b('0xf')]||null:null,'limit':_0xb37ea4[_0x931b('0x8')]?_0xb37ea4[_0x931b('0x8')][_0x931b('0xb')]||null:null,'order':_0xb37ea4[_0x931b('0x8')]?_0xb37ea4[_0x931b('0x8')][_0x931b('0x22')]||null:null,'transaction':_0x18182,'lock':_0x18182[_0x931b('0x23')][_0x931b('0x24')],'include':[{'model':db['CmContact'],'as':_0x931b('0x25'),'attributes':_[_0x931b('0x26')](_0x49c36e)},{'model':db['User'],'as':_0x931b('0x27'),'attributes':['id','name',_0x931b('0x28')]}]})[_0x931b('0x10')](function(_0x4442c1){var _0x29beae=[];var _0x2f437a=[];for(var _0x333306=0x0;_0x333306<_0x4442c1['length'];_0x333306+=0x1){var _0xf82002=_0x4442c1[_0x333306][_0x931b('0x29')];if(_0xf82002===null){_0x29beae[_0x931b('0x2a')](_0x4442c1[_0x333306][_0x931b('0x1b')](_0xb37ea4[_0x931b('0x1a')],{'transaction':_0x18182}));}else if(!_0x2f437a[_0x931b('0x2b')](_0xf82002)){_0x2f437a[_0x931b('0x2a')](_0xf82002);_0x29beae['push'](_0x4442c1[_0x333306][_0x931b('0x1b')](_0xb37ea4['body'],{'transaction':_0x18182}));}}return BPromise[_0x931b('0x2c')](_0x29beae);});})[_0x931b('0x10')](function(_0x49a467){logger[_0x931b('0x11')](_0x931b('0x21'),_0xb37ea4);if(_0x49a467[_0x931b('0x2d')]>0x0){logger[_0x931b('0x11')](_0x931b('0x2e'),_0x49a467[0x0][_0x931b('0x2f')]['id'],_0x49a467[0x0]['dataValues'][_0x931b('0x30')],_0x49a467[0x0]['dataValues'][_0x931b('0x1e')]);}logger[_0x931b('0x12')]('GetContactDialer',_0xb37ea4,JSON['stringify'](_0x49a467));_0x2abd78(_0x49a467);})[_0x931b('0x17')](function(_0x25cf76){logger[_0x931b('0x14')](_0x931b('0x21'),_0x25cf76[_0x931b('0x15')],_0xb37ea4);_0x299225(_0x37e1a9['error'](0x1f4,_0x25cf76[_0x931b('0x15')]));});});});};exports[_0x931b('0x31')]=function(_0x2cabcd){var _0x3334b5=this;return new Promise(function(_0x5a7b59,_0x2f3038){return db[_0x931b('0x32')][_0x931b('0x33')](function(_0x19f85a){return db[_0x931b('0x34')][_0x931b('0x19')](_0x2cabcd[_0x931b('0x1a')],{'raw':_0x2cabcd[_0x931b('0x8')]?_0x2cabcd[_0x931b('0x8')][_0x931b('0x9')]===undefined?!![]:![]:!![],'transaction':_0x19f85a})[_0x931b('0x10')](function(){logger[_0x931b('0x11')](_0x931b('0x35'),JSON[_0x931b('0x13')](_0x2cabcd['options'][_0x931b('0xa')]),_0x2cabcd[_0x931b('0x8')]['where']['active']);return db[_0x931b('0x6')][_0x931b('0x20')]({'where':_0x2cabcd['options']?_0x2cabcd[_0x931b('0x8')][_0x931b('0xa')]||null:null,'transaction':_0x19f85a});});})['then'](function(_0x5bfd7d){logger['info'](_0x931b('0x31'),_0x2cabcd);logger[_0x931b('0x12')]('MoveContactManagedDialer',_0x2cabcd,JSON[_0x931b('0x13')](_0x5bfd7d));_0x5a7b59(_0x5bfd7d);})[_0x931b('0x17')](function(_0x1f5d5b){logger['error'](_0x931b('0x31'),_0x1f5d5b[_0x931b('0x15')],_0x2cabcd);_0x2f3038(_0x3334b5[_0x931b('0x14')](0x1f4,_0x1f5d5b['message']));});});};exports[_0x931b('0x36')]=function(_0x62cb69){var _0x2eca9d=this;return new Promise(function(_0x2f2c05,_0x1706a0){return db['CmHopper'][_0x931b('0x7')]({'raw':_0x62cb69[_0x931b('0x8')]?_0x62cb69['options']['raw']===undefined?!![]:![]:!![],'where':_0x62cb69[_0x931b('0x8')]?_0x62cb69[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':[[db['sequelize']['fn'](_0x931b('0x37'),db[_0x931b('0x32')]['fn']('IF',db[_0x931b('0x32')][_0x931b('0x38')](_0x931b('0x39')+util['format'](_0x931b('0x3a'),moment()[_0x931b('0x3b')](_0x931b('0x3c')))+_0x931b('0x3d')))),_0x931b('0x3e')]]})['then'](function(_0x4b428c){logger[_0x931b('0x11')](_0x931b('0x36'),_0x62cb69);logger['debug'](_0x931b('0x36'),_0x62cb69,JSON['stringify'](_0x4b428c));_0x2f2c05(_0x4b428c);})[_0x931b('0x17')](function(_0x180158){logger[_0x931b('0x14')]('CountReScheduled',_0x180158[_0x931b('0x15')],_0x62cb69);_0x1706a0(_0x2eca9d[_0x931b('0x14')](0x1f4,_0x180158[_0x931b('0x15')]));});});};exports[_0x931b('0x3f')]=function(_0x1240ed){var _0x3c7e1d=this;return new Promise(function(_0x1cc6ba,_0x5b1ccd){return db[_0x931b('0x40')][_0x931b('0x41')]()[_0x931b('0x10')](function(){return db[_0x931b('0x32')][_0x931b('0x33')](function(_0x461205){return db[_0x931b('0x6')][_0x931b('0x7')]({'where':_0x1240ed[_0x931b('0x8')]?_0x1240ed[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':_0x1240ed[_0x931b('0x8')]?_0x1240ed[_0x931b('0x8')][_0x931b('0xf')]||null:null,'limit':0x1,'order':_0x1240ed['options']?_0x1240ed[_0x931b('0x8')][_0x931b('0x22')]||null:null,'group':db[_0x931b('0x6')][_0x931b('0x29')],'transaction':_0x461205,'lock':_0x461205[_0x931b('0x23')][_0x931b('0x24')],'include':_0x1240ed[_0x931b('0x8')]?_0x1240ed[_0x931b('0x8')]['include']?_[_0x931b('0xd')](_0x1240ed[_0x931b('0x8')]['include'],function(_0x4b8b34){return{'model':db[_0x4b8b34[_0x931b('0xe')]],'as':_0x4b8b34['as'],'attributes':_0x4b8b34['attributes'],'include':_0x4b8b34[_0x931b('0xc')]?_[_0x931b('0xd')](_0x4b8b34['include'],function(_0x4afdd6){return{'model':db[_0x4afdd6[_0x931b('0xe')]],'as':_0x4afdd6['as'],'attributes':_0x4afdd6['attributes'],'include':_0x4afdd6['include']?_[_0x931b('0xd')](_0x4afdd6[_0x931b('0xc')],function(_0x358bc0){return{'model':db[_0x358bc0[_0x931b('0xe')]],'as':_0x358bc0['as'],'attributes':_0x358bc0[_0x931b('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x287708){var _0x156ee9=[];for(var _0xdf54b0=0x0;_0xdf54b0<_0x287708[_0x931b('0x2d')];_0xdf54b0+=0x1){_0x156ee9[_0x931b('0x2a')](_0x287708[_0xdf54b0][_0x931b('0x1b')](_0x1240ed[_0x931b('0x1a')],{'transaction':_0x461205}));}return BPromise[_0x931b('0x2c')](_0x156ee9);});})[_0x931b('0x10')](function(_0x4942ec){logger[_0x931b('0x11')](_0x931b('0x3f'),_0x1240ed);logger[_0x931b('0x12')]('GetContactRecallMe',_0x1240ed,JSON[_0x931b('0x13')](_0x4942ec));_0x1cc6ba(_0x4942ec);})[_0x931b('0x17')](function(_0x2eceea){logger['error'](_0x931b('0x3f'),_0x2eceea[_0x931b('0x15')],_0x1240ed);_0x5b1ccd(_0x3c7e1d[_0x931b('0x14')](0x1f4,_0x2eceea['message']));});});});};exports[_0x931b('0x42')]=function(_0x126d2f){var _0x3f70f1=this;return new Promise(function(_0x166499,_0xe75079){db[_0x931b('0x40')][_0x931b('0x41')]()[_0x931b('0x10')](function(_0x1f7a05){return db['CmHopper']['findAll']({'raw':_0x126d2f['options']?_0x126d2f['options'][_0x931b('0x9')]===undefined?!![]:![]:!![],'where':_0x126d2f[_0x931b('0x8')]?_0x126d2f[_0x931b('0x8')][_0x931b('0xa')]||null:null,'attributes':_0x126d2f['options']?_0x126d2f[_0x931b('0x8')]['attributes']||null:null,'limit':_0x126d2f[_0x931b('0x8')]?_0x126d2f[_0x931b('0x8')]['limit']||null:null,'include':_0x126d2f['options']?_0x126d2f['options'][_0x931b('0xc')]?_['map'](_0x126d2f[_0x931b('0x8')][_0x931b('0xc')],function(_0x1c972e){return{'model':db[_0x1c972e[_0x931b('0xe')]],'as':_0x1c972e['as'],'attributes':_0x1c972e['as']===_0x931b('0x25')?_['keys'](_0x1f7a05):_0x1c972e[_0x931b('0xf')],'include':_0x1c972e[_0x931b('0xc')]?_['map'](_0x1c972e['include'],function(_0x39928e){return{'model':db[_0x39928e['model']],'as':_0x39928e['as'],'attributes':_0x39928e[_0x931b('0xf')],'include':_0x39928e[_0x931b('0xc')]?_['map'](_0x39928e[_0x931b('0xc')],function(_0x1c7554){return{'model':db[_0x1c7554[_0x931b('0xe')]],'as':_0x1c7554['as'],'attributes':_0x1c7554['attributes']};}):[]};}):[]};}):[]:[]})[_0x931b('0x10')](function(_0x59772d){logger[_0x931b('0x11')](_0x931b('0x5'),_0x126d2f);logger[_0x931b('0x12')](_0x931b('0x5'),_0x126d2f,JSON['stringify'](_0x59772d));_0x166499(_0x59772d);})[_0x931b('0x17')](function(_0xe447d0){logger[_0x931b('0x14')](_0x931b('0x5'),_0xe447d0[_0x931b('0x15')],_0x126d2f);_0xe75079(_0x3f70f1[_0x931b('0x14')](0x1f4,_0xe447d0[_0x931b('0x15')]));});});});};exports['GetContactByPhone']=function(_0x242546){var _0x628278=this;return new Promise(function(_0x1c37aa,_0x142e6d){return db[_0x931b('0x40')][_0x931b('0x43')]({'raw':!![],'where':{'phone':_0x242546[_0x931b('0x8')]['where'][_0x931b('0x44')]},'attributes':['id',_0x931b('0x45')],'order':[['id',_0x931b('0x46')]]})[_0x931b('0x10')](function(_0x5243ed){logger['info'](_0x931b('0x47'),_0x242546);logger['debug']('getContactByPhone',_0x242546,JSON[_0x931b('0x13')](_0x5243ed));_0x1c37aa(_0x5243ed);})[_0x931b('0x17')](function(_0x4bdcd8){logger[_0x931b('0x14')](_0x931b('0x47'),_0x4bdcd8[_0x931b('0x15')],_0x242546);_0x142e6d(_0x628278['error'](0x1f4,_0x4bdcd8[_0x931b('0x15')]));});});};exports['ResetActiveCalls']=function(_0x1aaf3f){var _0x306961=this;return new Promise(function(_0x547b75,_0x642d57){return db[_0x931b('0x32')][_0x931b('0x33')](function(_0xc87405){var _0x20dee5=_0x1aaf3f[_0x931b('0x8')]&&_0x1aaf3f[_0x931b('0x8')][_0x931b('0xa')]?_0x1aaf3f[_0x931b('0x8')][_0x931b('0xa')]:{};return db['CmHopper'][_0x931b('0x1b')](_0x1aaf3f[_0x931b('0x1a')],{'where':_0x20dee5,'transaction':_0xc87405})[_0x931b('0x10')](function(_0x4e0315){logger[_0x931b('0x11')]('ResetActiveCalls',_0x1aaf3f);logger[_0x931b('0x12')](_0x931b('0x48'),_0x1aaf3f,JSON[_0x931b('0x13')](_0x4e0315));_0x547b75(_0x4e0315);})['catch'](function(_0x3988a3){logger[_0x931b('0x14')](_0x931b('0x48'),_0x3988a3[_0x931b('0x15')],_0x1aaf3f);_0x642d57(_0x306961[_0x931b('0x14')](0x1f4,_0x3988a3[_0x931b('0x15')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x3c593f){var _0x56fc33=this;var _0x1ed045=_0x3c593f[_0x931b('0x1a')][_0x931b('0xa')][_0x931b('0x49')];var _0x36b375=_0x3c593f[_0x931b('0x1a')][_0x931b('0xa')][_0x931b('0x4a')];var _0x57b3c4=_0x3c593f[_0x931b('0x1a')][_0x931b('0xa')][_0x931b('0x4b')];return new Promise(function(_0x21d06,_0xbc1a15){return db[_0x931b('0x6')][_0x931b('0x7')]({'where':{'voiceQueueId':{'$in':_0x1ed045},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x931b('0x32')][_0x931b('0x38')](_0x931b('0x4c')+_0x36b375+_0x931b('0x4d')),'$gt':db[_0x931b('0x32')]['literal'](_0x931b('0x4e'))}},'UserId':{'$in':_0x57b3c4}},'include':[{'model':db['CmContact'],'as':_0x931b('0x25')},{'model':db[_0x931b('0x4f')],'as':_0x931b('0x27'),'attributes':['id','name',_0x931b('0x28')]},{'model':db['CmList'],'as':_0x931b('0x50')}]})['then'](function(_0x4f3093){if(_0x4f3093[_0x931b('0x2d')]>0x0){return db[_0x931b('0x32')][_0x931b('0x33')](function(_0x454577){return db[_0x931b('0x6')]['update']({'recallmeNotifiedDate':db[_0x931b('0x32')][_0x931b('0x38')]('NOW()')},{'where':{'id':{'$in':_[_0x931b('0xd')](_0x4f3093,'id')}},'transaction':_0x454577})[_0x931b('0x10')](function(){_0x21d06(_0x4f3093);})[_0x931b('0x17')](function(_0x3c4302){logger[_0x931b('0x14')](_0x931b('0x51'),_0x3c4302['message'],_0x3c593f);_0xbc1a15(_0x56fc33[_0x931b('0x14')](0x1f4,_0x3c4302[_0x931b('0x15')]));});})['catch'](function(_0x86535b){logger['error'](_0x931b('0x51'),_0x86535b[_0x931b('0x15')],_0x3c593f);_0xbc1a15(_0x56fc33['error'](0x1f4,_0x86535b[_0x931b('0x15')]));});}else{_0x21d06(_0x4f3093);}});});};