Built motion from commit 6362bb75.|2.6.13
[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 _0x1002=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','catch','lodash','util'];(function(_0x2e7c26,_0x518baa){var _0x33b450=function(_0x5377ec){while(--_0x5377ec){_0x2e7c26['push'](_0x2e7c26['shift']());}};_0x33b450(++_0x518baa);}(_0x1002,0x112));var _0x2100=function(_0xd26644,_0x4bafdd){_0xd26644=_0xd26644-0x0;var _0x358ac3=_0x1002[_0xd26644];return _0x358ac3;};'use strict';var _=require(_0x2100('0x0'));var util=require(_0x2100('0x1'));var moment=require(_0x2100('0x2'));var BPromise=require(_0x2100('0x3'));var rs=require(_0x2100('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2100('0x5'))['db'];var utils=require(_0x2100('0x6'));var logger=require(_0x2100('0x7'))(_0x2100('0x8'));var config=require(_0x2100('0x9'));var jayson=require(_0x2100('0xa'));var client=jayson[_0x2100('0xb')]['http']({'port':0x232a});config[_0x2100('0xc')]=_[_0x2100('0xd')](config[_0x2100('0xc')],{'host':_0x2100('0xe'),'port':0x18eb});var socket=require(_0x2100('0xf'))(new Redis(config[_0x2100('0xc')]));require('./voiceQueueReport.socket')[_0x2100('0x10')](socket);function respondWithRpcPromise(_0x5e5fd2,_0x4993d2,_0x43f1de){return new BPromise(function(_0x376ad7,_0x18d968){return client[_0x2100('0x11')](_0x5e5fd2,_0x43f1de)[_0x2100('0x12')](function(_0x256928){logger[_0x2100('0x13')](_0x2100('0x14'),_0x4993d2,_0x2100('0x15'));logger[_0x2100('0x16')](_0x2100('0x17'),_0x4993d2,_0x2100('0x15'),JSON[_0x2100('0x18')](_0x256928));if(_0x256928[_0x2100('0x19')]){if(_0x256928['error'][_0x2100('0x1a')]===0x1f4){logger[_0x2100('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x4993d2,_0x256928[_0x2100('0x19')][_0x2100('0x1b')]);return _0x18d968(_0x256928[_0x2100('0x19')]['message']);}logger[_0x2100('0x19')](_0x2100('0x14'),_0x4993d2,_0x256928[_0x2100('0x19')][_0x2100('0x1b')]);return _0x376ad7(_0x256928[_0x2100('0x19')][_0x2100('0x1b')]);}else{logger['info'](_0x2100('0x14'),_0x4993d2,_0x2100('0x15'));_0x376ad7(_0x256928[_0x2100('0x1c')][_0x2100('0x1b')]);}})['catch'](function(_0x1888b3){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x4993d2,_0x1888b3);_0x18d968(_0x1888b3);});});}exports['GetVoiceQueueReport']=function(_0x5e8ed2){var _0x3a0f97=this;return new Promise(function(_0x237c62,_0x44b643){return db[_0x2100('0x1d')][_0x2100('0x1e')]({'raw':_0x5e8ed2[_0x2100('0x1f')]?_0x5e8ed2[_0x2100('0x1f')][_0x2100('0x20')]===undefined?!![]:![]:!![],'where':_0x5e8ed2[_0x2100('0x1f')]?_0x5e8ed2['options'][_0x2100('0x21')]||null:null,'attributes':_0x5e8ed2[_0x2100('0x1f')]?_0x5e8ed2[_0x2100('0x1f')]['attributes']||null:null,'limit':_0x5e8ed2[_0x2100('0x1f')]?_0x5e8ed2[_0x2100('0x1f')][_0x2100('0x22')]||null:null,'include':_0x5e8ed2['options']?_0x5e8ed2[_0x2100('0x1f')][_0x2100('0x23')]?_[_0x2100('0x24')](_0x5e8ed2[_0x2100('0x1f')]['include'],function(_0x499413){return{'model':db[_0x499413[_0x2100('0x25')]],'as':_0x499413['as'],'attributes':_0x499413[_0x2100('0x26')],'include':_0x499413[_0x2100('0x23')]?_[_0x2100('0x24')](_0x499413[_0x2100('0x23')],function(_0x286b30){return{'model':db[_0x286b30[_0x2100('0x25')]],'as':_0x286b30['as'],'attributes':_0x286b30[_0x2100('0x26')],'include':_0x286b30['include']?_['map'](_0x286b30[_0x2100('0x23')],function(_0x371529){return{'model':db[_0x371529[_0x2100('0x25')]],'as':_0x371529['as'],'attributes':_0x371529['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x55a0ac){logger[_0x2100('0x13')](_0x2100('0x27'),_0x5e8ed2);logger[_0x2100('0x16')](_0x2100('0x27'),_0x5e8ed2,JSON['stringify'](_0x55a0ac));_0x237c62(_0x55a0ac);})['catch'](function(_0x40cc5a){logger['error'](_0x2100('0x27'),_0x40cc5a[_0x2100('0x1b')],_0x5e8ed2);_0x44b643(_0x3a0f97[_0x2100('0x19')](0x1f4,_0x40cc5a[_0x2100('0x1b')]));});});};exports[_0x2100('0x28')]=function(_0x1bfd34){var _0x3a1efe=this;return new Promise(function(_0x3e7a6e,_0x208b89){return db[_0x2100('0x1d')][_0x2100('0x29')](_0x1bfd34[_0x2100('0x2a')],{'raw':_0x1bfd34[_0x2100('0x1f')]?_0x1bfd34['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0xe427e5){logger[_0x2100('0x13')]('CreateVoiceQueueReport',_0x1bfd34);logger[_0x2100('0x16')](_0x2100('0x28'),_0x1bfd34,JSON[_0x2100('0x18')](_0xe427e5));_0x3e7a6e(_0xe427e5);})['catch'](function(_0x7e12d){logger['error']('CreateVoiceQueueReport',_0x7e12d['message'],_0x1bfd34);_0x208b89(_0x3a1efe[_0x2100('0x19')](0x1f4,_0x7e12d[_0x2100('0x1b')]));});});};exports[_0x2100('0x2b')]=function(_0x2f9fc9){var _0x39da16=this;return new Promise(function(_0x460b64,_0x21b9a5){return db['VoiceQueueReport'][_0x2100('0x2c')](_0x2f9fc9[_0x2100('0x2a')],{'raw':_0x2f9fc9[_0x2100('0x1f')]?_0x2f9fc9[_0x2100('0x1f')][_0x2100('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f9fc9[_0x2100('0x1f')]?_0x2f9fc9[_0x2100('0x1f')][_0x2100('0x21')]||null:null,'attributes':_0x2f9fc9[_0x2100('0x1f')]?_0x2f9fc9[_0x2100('0x1f')][_0x2100('0x26')]||null:null,'limit':_0x2f9fc9[_0x2100('0x1f')]?_0x2f9fc9[_0x2100('0x1f')][_0x2100('0x22')]||null:null})[_0x2100('0x12')](function(_0x51e52d){logger[_0x2100('0x13')](_0x2100('0x2b'),_0x2f9fc9);logger[_0x2100('0x16')](_0x2100('0x2b'),_0x2f9fc9,JSON[_0x2100('0x18')](_0x51e52d));_0x460b64(_0x51e52d);})[_0x2100('0x2d')](function(_0x57bec4){logger[_0x2100('0x19')](_0x2100('0x2b'),_0x57bec4[_0x2100('0x1b')],_0x2f9fc9);_0x21b9a5(_0x39da16[_0x2100('0x19')](0x1f4,_0x57bec4[_0x2100('0x1b')]));});});};