Built motion from commit (unavailable).|2.5.11
[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 _0x8001=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceQueueReport','options','raw','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0x8001,0xac));var _0x1800=function(_0x1dcd67,_0x1f57f5){_0x1dcd67=_0x1dcd67-0x0;var _0x273658=_0x8001[_0x1dcd67];return _0x273658;};'use strict';var _=require(_0x1800('0x0'));var util=require(_0x1800('0x1'));var moment=require(_0x1800('0x2'));var BPromise=require(_0x1800('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1800('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1800('0x5'));var logger=require(_0x1800('0x6'))(_0x1800('0x7'));var config=require(_0x1800('0x8'));var jayson=require(_0x1800('0x9'));var client=jayson[_0x1800('0xa')][_0x1800('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1800('0xc')],{'host':_0x1800('0xd'),'port':0x18eb});var socket=require(_0x1800('0xe'))(new Redis(config[_0x1800('0xc')]));require('./voiceQueueReport.socket')[_0x1800('0xf')](socket);function respondWithRpcPromise(_0x3b0ac3,_0x453aa5,_0x3adb78){return new BPromise(function(_0x201b01,_0x4f6c05){return client['request'](_0x3b0ac3,_0x3adb78)[_0x1800('0x10')](function(_0x2f9c68){logger[_0x1800('0x11')](_0x1800('0x12'),_0x453aa5,'request\x20sent');logger[_0x1800('0x13')](_0x1800('0x14'),_0x453aa5,_0x1800('0x15'),JSON[_0x1800('0x16')](_0x2f9c68));if(_0x2f9c68[_0x1800('0x17')]){if(_0x2f9c68[_0x1800('0x17')][_0x1800('0x18')]===0x1f4){logger[_0x1800('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x453aa5,_0x2f9c68[_0x1800('0x17')][_0x1800('0x19')]);return _0x4f6c05(_0x2f9c68['error'][_0x1800('0x19')]);}logger[_0x1800('0x17')](_0x1800('0x12'),_0x453aa5,_0x2f9c68['error'][_0x1800('0x19')]);return _0x201b01(_0x2f9c68['error'][_0x1800('0x19')]);}else{logger[_0x1800('0x11')](_0x1800('0x12'),_0x453aa5,'request\x20sent');_0x201b01(_0x2f9c68[_0x1800('0x1a')][_0x1800('0x19')]);}})[_0x1800('0x1b')](function(_0x21a586){logger['error'](_0x1800('0x12'),_0x453aa5,_0x21a586);_0x4f6c05(_0x21a586);});});}exports['GetVoiceQueueReport']=function(_0xc59744){var _0x599379=this;return new Promise(function(_0x3a0f24,_0x524ce0){return db[_0x1800('0x1c')]['findAll']({'raw':_0xc59744[_0x1800('0x1d')]?_0xc59744['options'][_0x1800('0x1e')]===undefined?!![]:![]:!![],'where':_0xc59744[_0x1800('0x1d')]?_0xc59744[_0x1800('0x1d')]['where']||null:null,'attributes':_0xc59744[_0x1800('0x1d')]?_0xc59744[_0x1800('0x1d')][_0x1800('0x1f')]||null:null,'limit':_0xc59744['options']?_0xc59744[_0x1800('0x1d')][_0x1800('0x20')]||null:null,'include':_0xc59744['options']?_0xc59744[_0x1800('0x1d')][_0x1800('0x21')]?_[_0x1800('0x22')](_0xc59744[_0x1800('0x1d')][_0x1800('0x21')],function(_0x2d0ad9){return{'model':db[_0x2d0ad9[_0x1800('0x23')]],'as':_0x2d0ad9['as'],'attributes':_0x2d0ad9[_0x1800('0x1f')],'include':_0x2d0ad9['include']?_[_0x1800('0x22')](_0x2d0ad9['include'],function(_0x3a16df){return{'model':db[_0x3a16df[_0x1800('0x23')]],'as':_0x3a16df['as'],'attributes':_0x3a16df['attributes'],'include':_0x3a16df['include']?_[_0x1800('0x22')](_0x3a16df[_0x1800('0x21')],function(_0x2f07d3){return{'model':db[_0x2f07d3[_0x1800('0x23')]],'as':_0x2f07d3['as'],'attributes':_0x2f07d3[_0x1800('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x252dad){logger[_0x1800('0x11')]('GetVoiceQueueReport',_0xc59744);logger[_0x1800('0x13')](_0x1800('0x24'),_0xc59744,JSON[_0x1800('0x16')](_0x252dad));_0x3a0f24(_0x252dad);})[_0x1800('0x1b')](function(_0x4c9a58){logger['error']('GetVoiceQueueReport',_0x4c9a58[_0x1800('0x19')],_0xc59744);_0x524ce0(_0x599379['error'](0x1f4,_0x4c9a58[_0x1800('0x19')]));});});};exports[_0x1800('0x25')]=function(_0xc74fcc){var _0x1228a4=this;return new Promise(function(_0x5e765b,_0x52ecb8){return db['VoiceQueueReport'][_0x1800('0x26')](_0xc74fcc[_0x1800('0x27')],{'raw':_0xc74fcc[_0x1800('0x1d')]?_0xc74fcc['options'][_0x1800('0x1e')]===undefined?!![]:![]:!![]})[_0x1800('0x10')](function(_0x634b1e){logger[_0x1800('0x11')](_0x1800('0x25'),_0xc74fcc);logger[_0x1800('0x13')]('CreateVoiceQueueReport',_0xc74fcc,JSON[_0x1800('0x16')](_0x634b1e));_0x5e765b(_0x634b1e);})[_0x1800('0x1b')](function(_0x53c602){logger[_0x1800('0x17')]('CreateVoiceQueueReport',_0x53c602[_0x1800('0x19')],_0xc74fcc);_0x52ecb8(_0x1228a4[_0x1800('0x17')](0x1f4,_0x53c602['message']));});});};exports[_0x1800('0x28')]=function(_0x153667){var _0x439bf8=this;return new Promise(function(_0x101c17,_0x214744){return db[_0x1800('0x1c')][_0x1800('0x29')](_0x153667['body'],{'raw':_0x153667[_0x1800('0x1d')]?_0x153667['options'][_0x1800('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x153667['options']?_0x153667[_0x1800('0x1d')][_0x1800('0x2a')]||null:null,'attributes':_0x153667[_0x1800('0x1d')]?_0x153667[_0x1800('0x1d')][_0x1800('0x1f')]||null:null,'limit':_0x153667['options']?_0x153667['options']['limit']||null:null})['then'](function(_0x3b9171){logger[_0x1800('0x11')](_0x1800('0x28'),_0x153667);logger[_0x1800('0x13')](_0x1800('0x28'),_0x153667,JSON[_0x1800('0x16')](_0x3b9171));_0x101c17(_0x3b9171);})[_0x1800('0x1b')](function(_0x261425){logger[_0x1800('0x17')](_0x1800('0x28'),_0x261425[_0x1800('0x19')],_0x153667);_0x214744(_0x439bf8['error'](0x1f4,_0x261425[_0x1800('0x19')]));});});};