Built motion from commit (unavailable).|2.5.10
[motion2.git] / server / api / voiceQueueReport / voiceQueueReport.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 _0x34b5=['then','info','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','model','map','CreateVoiceQueueReport','create','body','update','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0x34b5,0x1c9));var _0x534b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x534b('0x0'));var moment=require(_0x534b('0x1'));var BPromise=require(_0x534b('0x2'));var rs=require(_0x534b('0x3'));var fs=require('fs');var Redis=require(_0x534b('0x4'));var db=require(_0x534b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x534b('0x6'))(_0x534b('0x7'));var config=require('../../config/environment');var jayson=require(_0x534b('0x8'));var client=jayson[_0x534b('0x9')][_0x534b('0xa')]({'port':0x232a});config[_0x534b('0xb')]=_[_0x534b('0xc')](config[_0x534b('0xb')],{'host':_0x534b('0xd'),'port':0x18eb});var socket=require(_0x534b('0xe'))(new Redis(config[_0x534b('0xb')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x48b9b4,_0x1a0272,_0x1aaaf8){return new BPromise(function(_0x5041c2,_0x4bb745){return client[_0x534b('0xf')](_0x48b9b4,_0x1aaaf8)[_0x534b('0x10')](function(_0x9a97fa){logger[_0x534b('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x1a0272,'request\x20sent');logger[_0x534b('0x12')](_0x534b('0x13'),_0x1a0272,_0x534b('0x14'),JSON[_0x534b('0x15')](_0x9a97fa));if(_0x9a97fa['error']){if(_0x9a97fa[_0x534b('0x16')][_0x534b('0x17')]===0x1f4){logger['error'](_0x534b('0x18'),_0x1a0272,_0x9a97fa['error'][_0x534b('0x19')]);return _0x4bb745(_0x9a97fa[_0x534b('0x16')][_0x534b('0x19')]);}logger[_0x534b('0x16')](_0x534b('0x18'),_0x1a0272,_0x9a97fa[_0x534b('0x16')][_0x534b('0x19')]);return _0x5041c2(_0x9a97fa[_0x534b('0x16')][_0x534b('0x19')]);}else{logger[_0x534b('0x11')](_0x534b('0x18'),_0x1a0272,_0x534b('0x14'));_0x5041c2(_0x9a97fa[_0x534b('0x1a')][_0x534b('0x19')]);}})[_0x534b('0x1b')](function(_0x4998d7){logger[_0x534b('0x16')](_0x534b('0x18'),_0x1a0272,_0x4998d7);_0x4bb745(_0x4998d7);});});}exports[_0x534b('0x1c')]=function(_0x23b3b8){var _0x58cc6c=this;return new Promise(function(_0x55af67,_0x3e8657){return db[_0x534b('0x1d')]['findAll']({'raw':_0x23b3b8[_0x534b('0x1e')]?_0x23b3b8[_0x534b('0x1e')][_0x534b('0x1f')]===undefined?!![]:![]:!![],'where':_0x23b3b8[_0x534b('0x1e')]?_0x23b3b8['options'][_0x534b('0x20')]||null:null,'attributes':_0x23b3b8[_0x534b('0x1e')]?_0x23b3b8[_0x534b('0x1e')][_0x534b('0x21')]||null:null,'limit':_0x23b3b8[_0x534b('0x1e')]?_0x23b3b8[_0x534b('0x1e')][_0x534b('0x22')]||null:null,'include':_0x23b3b8[_0x534b('0x1e')]?_0x23b3b8[_0x534b('0x1e')][_0x534b('0x23')]?_['map'](_0x23b3b8[_0x534b('0x1e')][_0x534b('0x23')],function(_0x323542){return{'model':db[_0x323542[_0x534b('0x24')]],'as':_0x323542['as'],'attributes':_0x323542[_0x534b('0x21')],'include':_0x323542[_0x534b('0x23')]?_[_0x534b('0x25')](_0x323542[_0x534b('0x23')],function(_0x12f470){return{'model':db[_0x12f470['model']],'as':_0x12f470['as'],'attributes':_0x12f470[_0x534b('0x21')],'include':_0x12f470[_0x534b('0x23')]?_['map'](_0x12f470['include'],function(_0x148d8f){return{'model':db[_0x148d8f[_0x534b('0x24')]],'as':_0x148d8f['as'],'attributes':_0x148d8f['attributes']};}):[]};}):[]};}):[]:[]})[_0x534b('0x10')](function(_0x7bd061){logger[_0x534b('0x11')](_0x534b('0x1c'),_0x23b3b8);logger[_0x534b('0x12')](_0x534b('0x1c'),_0x23b3b8,JSON['stringify'](_0x7bd061));_0x55af67(_0x7bd061);})[_0x534b('0x1b')](function(_0x281dac){logger['error'](_0x534b('0x1c'),_0x281dac[_0x534b('0x19')],_0x23b3b8);_0x3e8657(_0x58cc6c['error'](0x1f4,_0x281dac[_0x534b('0x19')]));});});};exports[_0x534b('0x26')]=function(_0x36ff49){var _0x4e7c7a=this;return new Promise(function(_0x256844,_0x4504b8){return db[_0x534b('0x1d')][_0x534b('0x27')](_0x36ff49[_0x534b('0x28')],{'raw':_0x36ff49[_0x534b('0x1e')]?_0x36ff49['options'][_0x534b('0x1f')]===undefined?!![]:![]:!![]})[_0x534b('0x10')](function(_0x58fc7b){logger[_0x534b('0x11')](_0x534b('0x26'),_0x36ff49);logger[_0x534b('0x12')]('CreateVoiceQueueReport',_0x36ff49,JSON[_0x534b('0x15')](_0x58fc7b));_0x256844(_0x58fc7b);})[_0x534b('0x1b')](function(_0x5e250b){logger[_0x534b('0x16')]('CreateVoiceQueueReport',_0x5e250b['message'],_0x36ff49);_0x4504b8(_0x4e7c7a['error'](0x1f4,_0x5e250b[_0x534b('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0x485efd){var _0x3f2e94=this;return new Promise(function(_0xb96ce3,_0x1cb227){return db[_0x534b('0x1d')][_0x534b('0x29')](_0x485efd[_0x534b('0x28')],{'raw':_0x485efd[_0x534b('0x1e')]?_0x485efd['options'][_0x534b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x485efd[_0x534b('0x1e')]?_0x485efd[_0x534b('0x1e')][_0x534b('0x20')]||null:null,'attributes':_0x485efd[_0x534b('0x1e')]?_0x485efd['options']['attributes']||null:null,'limit':_0x485efd[_0x534b('0x1e')]?_0x485efd[_0x534b('0x1e')][_0x534b('0x22')]||null:null})['then'](function(_0x35e363){logger[_0x534b('0x11')](_0x534b('0x2a'),_0x485efd);logger[_0x534b('0x12')]('UpdateVoiceQueueReport',_0x485efd,JSON[_0x534b('0x15')](_0x35e363));_0xb96ce3(_0x35e363);})[_0x534b('0x1b')](function(_0x7c75c){logger[_0x534b('0x16')](_0x534b('0x2a'),_0x7c75c[_0x534b('0x19')],_0x485efd);_0x1cb227(_0x3f2e94[_0x534b('0x16')](0x1f4,_0x7c75c['message']));});});};