Built motion from commit (unavailable).|2.5.1
[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 _0x4af2=['register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetVoiceQueueReport','findAll','options','raw','where','include','model','map','attributes','CreateVoiceQueueReport','VoiceQueueReport','create','body','debug','UpdateVoiceQueueReport','update','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket'];(function(_0x50f37a,_0x3916de){var _0x35d7a9=function(_0x390260){while(--_0x390260){_0x50f37a['push'](_0x50f37a['shift']());}};_0x35d7a9(++_0x3916de);}(_0x4af2,0x1ca));var _0x24af=function(_0x4e97c0,_0x1c1c6b){_0x4e97c0=_0x4e97c0-0x0;var _0x280e84=_0x4af2[_0x4e97c0];return _0x280e84;};'use strict';var _=require('lodash');var util=require(_0x24af('0x0'));var moment=require(_0x24af('0x1'));var BPromise=require(_0x24af('0x2'));var rs=require(_0x24af('0x3'));var fs=require('fs');var Redis=require(_0x24af('0x4'));var db=require(_0x24af('0x5'))['db'];var utils=require(_0x24af('0x6'));var logger=require('../../config/logger')(_0x24af('0x7'));var config=require('../../config/environment');var jayson=require(_0x24af('0x8'));var client=jayson[_0x24af('0x9')]['http']({'port':0x232a});config[_0x24af('0xa')]=_[_0x24af('0xb')](config[_0x24af('0xa')],{'host':_0x24af('0xc'),'port':0x18eb});var socket=require(_0x24af('0xd'))(new Redis(config[_0x24af('0xa')]));require(_0x24af('0xe'))[_0x24af('0xf')](socket);function respondWithRpcPromise(_0x48d306,_0x488456,_0x231502){return new BPromise(function(_0x5d186c,_0x5b5d2b){return client[_0x24af('0x10')](_0x48d306,_0x231502)[_0x24af('0x11')](function(_0x258b4b){logger[_0x24af('0x12')](_0x24af('0x13'),_0x488456,'request\x20sent');logger['debug'](_0x24af('0x14'),_0x488456,_0x24af('0x15'),JSON[_0x24af('0x16')](_0x258b4b));if(_0x258b4b[_0x24af('0x17')]){if(_0x258b4b[_0x24af('0x17')]['code']===0x1f4){logger['error'](_0x24af('0x13'),_0x488456,_0x258b4b[_0x24af('0x17')][_0x24af('0x18')]);return _0x5b5d2b(_0x258b4b[_0x24af('0x17')]['message']);}logger[_0x24af('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x488456,_0x258b4b[_0x24af('0x17')][_0x24af('0x18')]);return _0x5d186c(_0x258b4b['error']['message']);}else{logger['info'](_0x24af('0x13'),_0x488456,_0x24af('0x15'));_0x5d186c(_0x258b4b['result'][_0x24af('0x18')]);}})[_0x24af('0x19')](function(_0x3c15bc){logger['error'](_0x24af('0x13'),_0x488456,_0x3c15bc);_0x5b5d2b(_0x3c15bc);});});}exports[_0x24af('0x1a')]=function(_0x375e58){var _0xabeb08=this;return new Promise(function(_0x35b6d6,_0x56c945){return db['VoiceQueueReport'][_0x24af('0x1b')]({'raw':_0x375e58[_0x24af('0x1c')]?_0x375e58['options'][_0x24af('0x1d')]===undefined?!![]:![]:!![],'where':_0x375e58['options']?_0x375e58[_0x24af('0x1c')][_0x24af('0x1e')]||null:null,'attributes':_0x375e58[_0x24af('0x1c')]?_0x375e58[_0x24af('0x1c')]['attributes']||null:null,'limit':_0x375e58[_0x24af('0x1c')]?_0x375e58[_0x24af('0x1c')]['limit']||null:null,'include':_0x375e58['options']?_0x375e58[_0x24af('0x1c')][_0x24af('0x1f')]?_['map'](_0x375e58[_0x24af('0x1c')]['include'],function(_0x51090e){return{'model':db[_0x51090e[_0x24af('0x20')]],'as':_0x51090e['as'],'attributes':_0x51090e['attributes'],'include':_0x51090e[_0x24af('0x1f')]?_[_0x24af('0x21')](_0x51090e['include'],function(_0x4f05e7){return{'model':db[_0x4f05e7[_0x24af('0x20')]],'as':_0x4f05e7['as'],'attributes':_0x4f05e7[_0x24af('0x22')],'include':_0x4f05e7[_0x24af('0x1f')]?_[_0x24af('0x21')](_0x4f05e7[_0x24af('0x1f')],function(_0x3b00a8){return{'model':db[_0x3b00a8[_0x24af('0x20')]],'as':_0x3b00a8['as'],'attributes':_0x3b00a8[_0x24af('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32ddf8){logger['info'](_0x24af('0x1a'),_0x375e58);logger['debug']('GetVoiceQueueReport',_0x375e58,JSON[_0x24af('0x16')](_0x32ddf8));_0x35b6d6(_0x32ddf8);})[_0x24af('0x19')](function(_0x28d5a8){logger[_0x24af('0x17')](_0x24af('0x1a'),_0x28d5a8[_0x24af('0x18')],_0x375e58);_0x56c945(_0xabeb08[_0x24af('0x17')](0x1f4,_0x28d5a8['message']));});});};exports[_0x24af('0x23')]=function(_0x1a9a53){var _0xab639=this;return new Promise(function(_0x3675ea,_0x1005a2){return db[_0x24af('0x24')][_0x24af('0x25')](_0x1a9a53[_0x24af('0x26')],{'raw':_0x1a9a53['options']?_0x1a9a53['options'][_0x24af('0x1d')]===undefined?!![]:![]:!![]})[_0x24af('0x11')](function(_0x2b1f13){logger['info'](_0x24af('0x23'),_0x1a9a53);logger[_0x24af('0x27')](_0x24af('0x23'),_0x1a9a53,JSON[_0x24af('0x16')](_0x2b1f13));_0x3675ea(_0x2b1f13);})[_0x24af('0x19')](function(_0x5d69e6){logger[_0x24af('0x17')]('CreateVoiceQueueReport',_0x5d69e6[_0x24af('0x18')],_0x1a9a53);_0x1005a2(_0xab639[_0x24af('0x17')](0x1f4,_0x5d69e6[_0x24af('0x18')]));});});};exports[_0x24af('0x28')]=function(_0x48a039){var _0x4294d8=this;return new Promise(function(_0x332506,_0x5ccc01){return db[_0x24af('0x24')][_0x24af('0x29')](_0x48a039[_0x24af('0x26')],{'raw':_0x48a039[_0x24af('0x1c')]?_0x48a039[_0x24af('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48a039['options']?_0x48a039[_0x24af('0x1c')][_0x24af('0x1e')]||null:null,'attributes':_0x48a039[_0x24af('0x1c')]?_0x48a039[_0x24af('0x1c')][_0x24af('0x22')]||null:null,'limit':_0x48a039[_0x24af('0x1c')]?_0x48a039[_0x24af('0x1c')][_0x24af('0x2a')]||null:null})[_0x24af('0x11')](function(_0x5298ea){logger[_0x24af('0x12')](_0x24af('0x28'),_0x48a039);logger[_0x24af('0x27')](_0x24af('0x28'),_0x48a039,JSON[_0x24af('0x16')](_0x5298ea));_0x332506(_0x5298ea);})[_0x24af('0x19')](function(_0x4a2cc0){logger[_0x24af('0x17')](_0x24af('0x28'),_0x4a2cc0[_0x24af('0x18')],_0x48a039);_0x5ccc01(_0x4294d8[_0x24af('0x17')](0x1f4,_0x4a2cc0[_0x24af('0x18')]));});});};