Built motion from commit (unavailable).|2.5.8
[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 _0x5ea8=['findAll','options','limit','include','map','model','attributes','CreateVoiceQueueReport','body','raw','stringify','UpdateVoiceQueueReport','update','where','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport'];(function(_0x2ca28b,_0x4d07fe){var _0x2321c8=function(_0x1d7e9b){while(--_0x1d7e9b){_0x2ca28b['push'](_0x2ca28b['shift']());}};_0x2321c8(++_0x4d07fe);}(_0x5ea8,0x8f));var _0x85ea=function(_0x31d217,_0x2ba380){_0x31d217=_0x31d217-0x0;var _0x977da9=_0x5ea8[_0x31d217];return _0x977da9;};'use strict';var _=require('lodash');var util=require(_0x85ea('0x0'));var moment=require('moment');var BPromise=require(_0x85ea('0x1'));var rs=require(_0x85ea('0x2'));var fs=require('fs');var Redis=require(_0x85ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x85ea('0x4'));var logger=require(_0x85ea('0x5'))(_0x85ea('0x6'));var config=require(_0x85ea('0x7'));var jayson=require(_0x85ea('0x8'));var client=jayson[_0x85ea('0x9')][_0x85ea('0xa')]({'port':0x232a});config[_0x85ea('0xb')]=_[_0x85ea('0xc')](config[_0x85ea('0xb')],{'host':_0x85ea('0xd'),'port':0x18eb});var socket=require(_0x85ea('0xe'))(new Redis(config[_0x85ea('0xb')]));require(_0x85ea('0xf'))['register'](socket);function respondWithRpcPromise(_0x218c15,_0x37172c,_0x29af3f){return new BPromise(function(_0x4dcd68,_0x543743){return client[_0x85ea('0x10')](_0x218c15,_0x29af3f)[_0x85ea('0x11')](function(_0x21be26){logger[_0x85ea('0x12')](_0x85ea('0x13'),_0x37172c,_0x85ea('0x14'));logger[_0x85ea('0x15')](_0x85ea('0x16'),_0x37172c,_0x85ea('0x14'),JSON['stringify'](_0x21be26));if(_0x21be26[_0x85ea('0x17')]){if(_0x21be26[_0x85ea('0x17')][_0x85ea('0x18')]===0x1f4){logger[_0x85ea('0x17')](_0x85ea('0x13'),_0x37172c,_0x21be26[_0x85ea('0x17')][_0x85ea('0x19')]);return _0x543743(_0x21be26[_0x85ea('0x17')][_0x85ea('0x19')]);}logger[_0x85ea('0x17')](_0x85ea('0x13'),_0x37172c,_0x21be26['error'][_0x85ea('0x19')]);return _0x4dcd68(_0x21be26[_0x85ea('0x17')][_0x85ea('0x19')]);}else{logger[_0x85ea('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x37172c,'request\x20sent');_0x4dcd68(_0x21be26['result'][_0x85ea('0x19')]);}})[_0x85ea('0x1a')](function(_0x4712af){logger[_0x85ea('0x17')](_0x85ea('0x13'),_0x37172c,_0x4712af);_0x543743(_0x4712af);});});}exports[_0x85ea('0x1b')]=function(_0x4c1c8f){var _0x551631=this;return new Promise(function(_0x3c4776,_0x471771){return db[_0x85ea('0x1c')][_0x85ea('0x1d')]({'raw':_0x4c1c8f[_0x85ea('0x1e')]?_0x4c1c8f[_0x85ea('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4c1c8f[_0x85ea('0x1e')]?_0x4c1c8f[_0x85ea('0x1e')]['where']||null:null,'attributes':_0x4c1c8f[_0x85ea('0x1e')]?_0x4c1c8f['options']['attributes']||null:null,'limit':_0x4c1c8f['options']?_0x4c1c8f[_0x85ea('0x1e')][_0x85ea('0x1f')]||null:null,'include':_0x4c1c8f[_0x85ea('0x1e')]?_0x4c1c8f[_0x85ea('0x1e')][_0x85ea('0x20')]?_[_0x85ea('0x21')](_0x4c1c8f['options'][_0x85ea('0x20')],function(_0x41815c){return{'model':db[_0x41815c[_0x85ea('0x22')]],'as':_0x41815c['as'],'attributes':_0x41815c[_0x85ea('0x23')],'include':_0x41815c[_0x85ea('0x20')]?_['map'](_0x41815c[_0x85ea('0x20')],function(_0x53031d){return{'model':db[_0x53031d['model']],'as':_0x53031d['as'],'attributes':_0x53031d[_0x85ea('0x23')],'include':_0x53031d['include']?_['map'](_0x53031d['include'],function(_0x24973f){return{'model':db[_0x24973f[_0x85ea('0x22')]],'as':_0x24973f['as'],'attributes':_0x24973f[_0x85ea('0x23')]};}):[]};}):[]};}):[]:[]})[_0x85ea('0x11')](function(_0x29b886){logger[_0x85ea('0x12')](_0x85ea('0x1b'),_0x4c1c8f);logger[_0x85ea('0x15')](_0x85ea('0x1b'),_0x4c1c8f,JSON['stringify'](_0x29b886));_0x3c4776(_0x29b886);})['catch'](function(_0x58d817){logger['error'](_0x85ea('0x1b'),_0x58d817[_0x85ea('0x19')],_0x4c1c8f);_0x471771(_0x551631[_0x85ea('0x17')](0x1f4,_0x58d817[_0x85ea('0x19')]));});});};exports[_0x85ea('0x24')]=function(_0x88ccc8){var _0x4e6f5d=this;return new Promise(function(_0x1b1544,_0x5caa64){return db[_0x85ea('0x1c')]['create'](_0x88ccc8[_0x85ea('0x25')],{'raw':_0x88ccc8[_0x85ea('0x1e')]?_0x88ccc8[_0x85ea('0x1e')][_0x85ea('0x26')]===undefined?!![]:![]:!![]})[_0x85ea('0x11')](function(_0x556995){logger['info'](_0x85ea('0x24'),_0x88ccc8);logger['debug'](_0x85ea('0x24'),_0x88ccc8,JSON[_0x85ea('0x27')](_0x556995));_0x1b1544(_0x556995);})[_0x85ea('0x1a')](function(_0x11eb89){logger['error']('CreateVoiceQueueReport',_0x11eb89[_0x85ea('0x19')],_0x88ccc8);_0x5caa64(_0x4e6f5d['error'](0x1f4,_0x11eb89[_0x85ea('0x19')]));});});};exports[_0x85ea('0x28')]=function(_0x57da3e){var _0x4e37ce=this;return new Promise(function(_0x47b91b,_0x26cb84){return db[_0x85ea('0x1c')][_0x85ea('0x29')](_0x57da3e[_0x85ea('0x25')],{'raw':_0x57da3e[_0x85ea('0x1e')]?_0x57da3e[_0x85ea('0x1e')][_0x85ea('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57da3e[_0x85ea('0x1e')]?_0x57da3e[_0x85ea('0x1e')][_0x85ea('0x2a')]||null:null,'attributes':_0x57da3e['options']?_0x57da3e[_0x85ea('0x1e')]['attributes']||null:null,'limit':_0x57da3e[_0x85ea('0x1e')]?_0x57da3e[_0x85ea('0x1e')]['limit']||null:null})[_0x85ea('0x11')](function(_0x4a5e57){logger[_0x85ea('0x12')](_0x85ea('0x28'),_0x57da3e);logger['debug'](_0x85ea('0x28'),_0x57da3e,JSON[_0x85ea('0x27')](_0x4a5e57));_0x47b91b(_0x4a5e57);})[_0x85ea('0x1a')](function(_0x5a4ed9){logger[_0x85ea('0x17')](_0x85ea('0x28'),_0x5a4ed9[_0x85ea('0x19')],_0x57da3e);_0x26cb84(_0x4e37ce[_0x85ea('0x17')](0x1f4,_0x5a4ed9[_0x85ea('0x19')]));});});};