Built motion from commit d1eab355.|2.6.28
[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 _0xec8a=['CreateVoiceQueueReport','body','raw','catch','UpdateVoiceQueueReport','debug','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','error','VoiceQueueReport,\x20%s,\x20%s','message','result','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','GetVoiceQueueReport','stringify'];(function(_0x4b0ec2,_0x1a2dbb){var _0x5cd98a=function(_0x1b1673){while(--_0x1b1673){_0x4b0ec2['push'](_0x4b0ec2['shift']());}};_0x5cd98a(++_0x1a2dbb);}(_0xec8a,0xd3));var _0xaec8=function(_0x29c238,_0x3d4890){_0x29c238=_0x29c238-0x0;var _0x1a0a43=_0xec8a[_0x29c238];return _0x1a0a43;};'use strict';var _=require(_0xaec8('0x0'));var util=require(_0xaec8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaec8('0x2'));var fs=require('fs');var Redis=require(_0xaec8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaec8('0x4'));var logger=require(_0xaec8('0x5'))(_0xaec8('0x6'));var config=require(_0xaec8('0x7'));var jayson=require(_0xaec8('0x8'));var client=jayson[_0xaec8('0x9')][_0xaec8('0xa')]({'port':0x232a});config[_0xaec8('0xb')]=_['defaults'](config[_0xaec8('0xb')],{'host':_0xaec8('0xc'),'port':0x18eb});var socket=require(_0xaec8('0xd'))(new Redis(config[_0xaec8('0xb')]));require(_0xaec8('0xe'))[_0xaec8('0xf')](socket);function respondWithRpcPromise(_0x3be604,_0x1430b5,_0x698f26){return new BPromise(function(_0x56052d,_0x56015f){return client[_0xaec8('0x10')](_0x3be604,_0x698f26)[_0xaec8('0x11')](function(_0x25dfe4){logger[_0xaec8('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1430b5,_0xaec8('0x13'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x1430b5,_0xaec8('0x13'),JSON['stringify'](_0x25dfe4));if(_0x25dfe4[_0xaec8('0x14')]){if(_0x25dfe4[_0xaec8('0x14')]['code']===0x1f4){logger[_0xaec8('0x14')](_0xaec8('0x15'),_0x1430b5,_0x25dfe4[_0xaec8('0x14')][_0xaec8('0x16')]);return _0x56015f(_0x25dfe4[_0xaec8('0x14')][_0xaec8('0x16')]);}logger[_0xaec8('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x1430b5,_0x25dfe4[_0xaec8('0x14')]['message']);return _0x56052d(_0x25dfe4[_0xaec8('0x14')][_0xaec8('0x16')]);}else{logger[_0xaec8('0x12')](_0xaec8('0x15'),_0x1430b5,'request\x20sent');_0x56052d(_0x25dfe4[_0xaec8('0x17')][_0xaec8('0x16')]);}})['catch'](function(_0x57ab22){logger[_0xaec8('0x14')](_0xaec8('0x15'),_0x1430b5,_0x57ab22);_0x56015f(_0x57ab22);});});}exports['GetVoiceQueueReport']=function(_0x19b942){var _0x2797c0=this;return new Promise(function(_0x1d57df,_0x57adcf){return db[_0xaec8('0x18')][_0xaec8('0x19')]({'raw':_0x19b942[_0xaec8('0x1a')]?_0x19b942[_0xaec8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x19b942[_0xaec8('0x1a')]?_0x19b942[_0xaec8('0x1a')][_0xaec8('0x1b')]||null:null,'attributes':_0x19b942[_0xaec8('0x1a')]?_0x19b942['options'][_0xaec8('0x1c')]||null:null,'limit':_0x19b942['options']?_0x19b942[_0xaec8('0x1a')][_0xaec8('0x1d')]||null:null,'include':_0x19b942[_0xaec8('0x1a')]?_0x19b942[_0xaec8('0x1a')][_0xaec8('0x1e')]?_[_0xaec8('0x1f')](_0x19b942[_0xaec8('0x1a')][_0xaec8('0x1e')],function(_0x1cdf0a){return{'model':db[_0x1cdf0a[_0xaec8('0x20')]],'as':_0x1cdf0a['as'],'attributes':_0x1cdf0a[_0xaec8('0x1c')],'include':_0x1cdf0a['include']?_['map'](_0x1cdf0a[_0xaec8('0x1e')],function(_0x240e46){return{'model':db[_0x240e46['model']],'as':_0x240e46['as'],'attributes':_0x240e46[_0xaec8('0x1c')],'include':_0x240e46['include']?_[_0xaec8('0x1f')](_0x240e46[_0xaec8('0x1e')],function(_0x4cbdb0){return{'model':db[_0x4cbdb0[_0xaec8('0x20')]],'as':_0x4cbdb0['as'],'attributes':_0x4cbdb0[_0xaec8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaec8('0x11')](function(_0x2aa754){logger[_0xaec8('0x12')](_0xaec8('0x21'),_0x19b942);logger['debug'](_0xaec8('0x21'),_0x19b942,JSON[_0xaec8('0x22')](_0x2aa754));_0x1d57df(_0x2aa754);})['catch'](function(_0x44ee7f){logger[_0xaec8('0x14')](_0xaec8('0x21'),_0x44ee7f['message'],_0x19b942);_0x57adcf(_0x2797c0['error'](0x1f4,_0x44ee7f[_0xaec8('0x16')]));});});};exports[_0xaec8('0x23')]=function(_0x48e075){var _0x4a136a=this;return new Promise(function(_0x4abe28,_0x66b39b){return db[_0xaec8('0x18')]['create'](_0x48e075[_0xaec8('0x24')],{'raw':_0x48e075[_0xaec8('0x1a')]?_0x48e075[_0xaec8('0x1a')][_0xaec8('0x25')]===undefined?!![]:![]:!![]})[_0xaec8('0x11')](function(_0x643a79){logger[_0xaec8('0x12')](_0xaec8('0x23'),_0x48e075);logger['debug'](_0xaec8('0x23'),_0x48e075,JSON[_0xaec8('0x22')](_0x643a79));_0x4abe28(_0x643a79);})[_0xaec8('0x26')](function(_0x41c10d){logger[_0xaec8('0x14')](_0xaec8('0x23'),_0x41c10d[_0xaec8('0x16')],_0x48e075);_0x66b39b(_0x4a136a[_0xaec8('0x14')](0x1f4,_0x41c10d[_0xaec8('0x16')]));});});};exports[_0xaec8('0x27')]=function(_0x226323){var _0x9ae839=this;return new Promise(function(_0x176b92,_0x275742){return db['VoiceQueueReport']['update'](_0x226323[_0xaec8('0x24')],{'raw':_0x226323[_0xaec8('0x1a')]?_0x226323[_0xaec8('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x226323['options']?_0x226323[_0xaec8('0x1a')][_0xaec8('0x1b')]||null:null,'attributes':_0x226323['options']?_0x226323['options'][_0xaec8('0x1c')]||null:null,'limit':_0x226323[_0xaec8('0x1a')]?_0x226323[_0xaec8('0x1a')]['limit']||null:null})[_0xaec8('0x11')](function(_0x176a35){logger[_0xaec8('0x12')](_0xaec8('0x27'),_0x226323);logger[_0xaec8('0x28')](_0xaec8('0x27'),_0x226323,JSON[_0xaec8('0x22')](_0x176a35));_0x176b92(_0x176a35);})['catch'](function(_0x406d46){logger[_0xaec8('0x14')]('UpdateVoiceQueueReport',_0x406d46['message'],_0x226323);_0x275742(_0x9ae839[_0xaec8('0x14')](0x1f4,_0x406d46[_0xaec8('0x16')]));});});};