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 _0x0231=['body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','GetVoiceQueueReport','create'];(function(_0x284e85,_0x1bfec9){var _0x59ba3d=function(_0x559559){while(--_0x559559){_0x284e85['push'](_0x284e85['shift']());}};_0x59ba3d(++_0x1bfec9);}(_0x0231,0x107));var _0x1023=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0231[_0x432682];return _0x463d05;};'use strict';var _=require(_0x1023('0x0'));var util=require(_0x1023('0x1'));var moment=require(_0x1023('0x2'));var BPromise=require(_0x1023('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1023('0x4'))['db'];var utils=require(_0x1023('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1023('0x6'));var jayson=require(_0x1023('0x7'));var client=jayson[_0x1023('0x8')][_0x1023('0x9')]({'port':0x232a});config[_0x1023('0xa')]=_['defaults'](config[_0x1023('0xa')],{'host':_0x1023('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1023('0xa')]));require(_0x1023('0xc'))[_0x1023('0xd')](socket);function respondWithRpcPromise(_0x1a2993,_0x4a3f82,_0x4debaf){return new BPromise(function(_0x5aba67,_0x477f33){return client[_0x1023('0xe')](_0x1a2993,_0x4debaf)[_0x1023('0xf')](function(_0xfe4cb5){logger[_0x1023('0x10')](_0x1023('0x11'),_0x4a3f82,_0x1023('0x12'));logger[_0x1023('0x13')](_0x1023('0x14'),_0x4a3f82,_0x1023('0x12'),JSON[_0x1023('0x15')](_0xfe4cb5));if(_0xfe4cb5[_0x1023('0x16')]){if(_0xfe4cb5[_0x1023('0x16')][_0x1023('0x17')]===0x1f4){logger[_0x1023('0x16')](_0x1023('0x11'),_0x4a3f82,_0xfe4cb5[_0x1023('0x16')]['message']);return _0x477f33(_0xfe4cb5['error'][_0x1023('0x18')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x4a3f82,_0xfe4cb5[_0x1023('0x16')][_0x1023('0x18')]);return _0x5aba67(_0xfe4cb5[_0x1023('0x16')][_0x1023('0x18')]);}else{logger[_0x1023('0x10')](_0x1023('0x11'),_0x4a3f82,_0x1023('0x12'));_0x5aba67(_0xfe4cb5[_0x1023('0x19')][_0x1023('0x18')]);}})[_0x1023('0x1a')](function(_0x176fe8){logger[_0x1023('0x16')](_0x1023('0x11'),_0x4a3f82,_0x176fe8);_0x477f33(_0x176fe8);});});}exports['GetVoiceQueueReport']=function(_0x1264c7){var _0x350d57=this;return new Promise(function(_0x1e2ede,_0x229b36){return db[_0x1023('0x1b')][_0x1023('0x1c')]({'raw':_0x1264c7['options']?_0x1264c7[_0x1023('0x1d')][_0x1023('0x1e')]===undefined?!![]:![]:!![],'where':_0x1264c7[_0x1023('0x1d')]?_0x1264c7[_0x1023('0x1d')][_0x1023('0x1f')]||null:null,'attributes':_0x1264c7['options']?_0x1264c7[_0x1023('0x1d')][_0x1023('0x20')]||null:null,'limit':_0x1264c7[_0x1023('0x1d')]?_0x1264c7[_0x1023('0x1d')]['limit']||null:null,'include':_0x1264c7[_0x1023('0x1d')]?_0x1264c7[_0x1023('0x1d')][_0x1023('0x21')]?_[_0x1023('0x22')](_0x1264c7[_0x1023('0x1d')]['include'],function(_0x56d5d1){return{'model':db[_0x56d5d1[_0x1023('0x23')]],'as':_0x56d5d1['as'],'attributes':_0x56d5d1[_0x1023('0x20')],'include':_0x56d5d1[_0x1023('0x21')]?_['map'](_0x56d5d1[_0x1023('0x21')],function(_0x1d75b5){return{'model':db[_0x1d75b5[_0x1023('0x23')]],'as':_0x1d75b5['as'],'attributes':_0x1d75b5[_0x1023('0x20')],'include':_0x1d75b5[_0x1023('0x21')]?_['map'](_0x1d75b5[_0x1023('0x21')],function(_0x4119cb){return{'model':db[_0x4119cb[_0x1023('0x23')]],'as':_0x4119cb['as'],'attributes':_0x4119cb[_0x1023('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1023('0xf')](function(_0x5bbad9){logger[_0x1023('0x10')](_0x1023('0x24'),_0x1264c7);logger[_0x1023('0x13')](_0x1023('0x24'),_0x1264c7,JSON[_0x1023('0x15')](_0x5bbad9));_0x1e2ede(_0x5bbad9);})['catch'](function(_0x4c6cb7){logger[_0x1023('0x16')](_0x1023('0x24'),_0x4c6cb7['message'],_0x1264c7);_0x229b36(_0x350d57[_0x1023('0x16')](0x1f4,_0x4c6cb7[_0x1023('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x226423){var _0xb42377=this;return new Promise(function(_0x36fa7a,_0x51057c){return db[_0x1023('0x1b')][_0x1023('0x25')](_0x226423[_0x1023('0x26')],{'raw':_0x226423[_0x1023('0x1d')]?_0x226423[_0x1023('0x1d')][_0x1023('0x1e')]===undefined?!![]:![]:!![]})[_0x1023('0xf')](function(_0x2f0edb){logger[_0x1023('0x10')]('CreateVoiceQueueReport',_0x226423);logger['debug'](_0x1023('0x27'),_0x226423,JSON[_0x1023('0x15')](_0x2f0edb));_0x36fa7a(_0x2f0edb);})[_0x1023('0x1a')](function(_0x4c8aaa){logger[_0x1023('0x16')](_0x1023('0x27'),_0x4c8aaa['message'],_0x226423);_0x51057c(_0xb42377[_0x1023('0x16')](0x1f4,_0x4c8aaa[_0x1023('0x18')]));});});};exports[_0x1023('0x28')]=function(_0x2a2335){var _0x446a63=this;return new Promise(function(_0x3a4367,_0x2c227a){return db[_0x1023('0x1b')][_0x1023('0x29')](_0x2a2335['body'],{'raw':_0x2a2335[_0x1023('0x1d')]?_0x2a2335[_0x1023('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a2335[_0x1023('0x1d')]?_0x2a2335[_0x1023('0x1d')]['where']||null:null,'attributes':_0x2a2335['options']?_0x2a2335[_0x1023('0x1d')][_0x1023('0x20')]||null:null,'limit':_0x2a2335[_0x1023('0x1d')]?_0x2a2335['options'][_0x1023('0x2a')]||null:null})[_0x1023('0xf')](function(_0x397b9a){logger['info'](_0x1023('0x28'),_0x2a2335);logger[_0x1023('0x13')](_0x1023('0x28'),_0x2a2335,JSON[_0x1023('0x15')](_0x397b9a));_0x3a4367(_0x397b9a);})[_0x1023('0x1a')](function(_0x29a907){logger[_0x1023('0x16')](_0x1023('0x28'),_0x29a907[_0x1023('0x18')],_0x2a2335);_0x2c227a(_0x446a63[_0x1023('0x16')](0x1f4,_0x29a907[_0x1023('0x18')]));});});};