1c880601806eea447341cd8882d98b982f8e1d92
[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 _0x9372=['body','UpdateVoiceQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','map','include','model','CreateVoiceQueueReport','create'];(function(_0x56f8b5,_0x4639ca){var _0x1add75=function(_0xbbe2dc){while(--_0xbbe2dc){_0x56f8b5['push'](_0x56f8b5['shift']());}};_0x1add75(++_0x4639ca);}(_0x9372,0x175));var _0x2937=function(_0x30ebda,_0x2ae541){_0x30ebda=_0x30ebda-0x0;var _0x2c3580=_0x9372[_0x30ebda];return _0x2c3580;};'use strict';var _=require(_0x2937('0x0'));var util=require(_0x2937('0x1'));var moment=require(_0x2937('0x2'));var BPromise=require(_0x2937('0x3'));var rs=require(_0x2937('0x4'));var fs=require('fs');var Redis=require(_0x2937('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2937('0x6'))(_0x2937('0x7'));var config=require(_0x2937('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2937('0x9')]({'port':0x232a});config[_0x2937('0xa')]=_[_0x2937('0xb')](config[_0x2937('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2937('0xc'))(new Redis(config[_0x2937('0xa')]));require('./voiceQueueReport.socket')[_0x2937('0xd')](socket);function respondWithRpcPromise(_0x1f7c76,_0x45a1c8,_0x29dfed){return new BPromise(function(_0x45bdae,_0x51bf92){return client['request'](_0x1f7c76,_0x29dfed)[_0x2937('0xe')](function(_0x48360b){logger[_0x2937('0xf')](_0x2937('0x10'),_0x45a1c8,_0x2937('0x11'));logger[_0x2937('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x45a1c8,'request\x20sent',JSON[_0x2937('0x13')](_0x48360b));if(_0x48360b[_0x2937('0x14')]){if(_0x48360b[_0x2937('0x14')][_0x2937('0x15')]===0x1f4){logger[_0x2937('0x14')](_0x2937('0x10'),_0x45a1c8,_0x48360b[_0x2937('0x14')]['message']);return _0x51bf92(_0x48360b['error']['message']);}logger['error'](_0x2937('0x10'),_0x45a1c8,_0x48360b[_0x2937('0x14')][_0x2937('0x16')]);return _0x45bdae(_0x48360b[_0x2937('0x14')][_0x2937('0x16')]);}else{logger[_0x2937('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x45a1c8,_0x2937('0x11'));_0x45bdae(_0x48360b[_0x2937('0x17')][_0x2937('0x16')]);}})[_0x2937('0x18')](function(_0x2b3429){logger[_0x2937('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x45a1c8,_0x2b3429);_0x51bf92(_0x2b3429);});});}exports[_0x2937('0x19')]=function(_0x1a0877){var _0x3b12fb=this;return new Promise(function(_0x46f667,_0x59f7db){return db[_0x2937('0x1a')][_0x2937('0x1b')]({'raw':_0x1a0877[_0x2937('0x1c')]?_0x1a0877[_0x2937('0x1c')][_0x2937('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a0877[_0x2937('0x1c')]?_0x1a0877['options'][_0x2937('0x1e')]||null:null,'attributes':_0x1a0877[_0x2937('0x1c')]?_0x1a0877[_0x2937('0x1c')][_0x2937('0x1f')]||null:null,'limit':_0x1a0877[_0x2937('0x1c')]?_0x1a0877[_0x2937('0x1c')]['limit']||null:null,'include':_0x1a0877[_0x2937('0x1c')]?_0x1a0877[_0x2937('0x1c')]['include']?_[_0x2937('0x20')](_0x1a0877[_0x2937('0x1c')]['include'],function(_0xf2c19){return{'model':db[_0xf2c19['model']],'as':_0xf2c19['as'],'attributes':_0xf2c19[_0x2937('0x1f')],'include':_0xf2c19['include']?_[_0x2937('0x20')](_0xf2c19[_0x2937('0x21')],function(_0x343795){return{'model':db[_0x343795[_0x2937('0x22')]],'as':_0x343795['as'],'attributes':_0x343795[_0x2937('0x1f')],'include':_0x343795['include']?_[_0x2937('0x20')](_0x343795[_0x2937('0x21')],function(_0x55c34f){return{'model':db[_0x55c34f['model']],'as':_0x55c34f['as'],'attributes':_0x55c34f[_0x2937('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2937('0xe')](function(_0x332111){logger[_0x2937('0xf')](_0x2937('0x19'),_0x1a0877);logger[_0x2937('0x12')](_0x2937('0x19'),_0x1a0877,JSON['stringify'](_0x332111));_0x46f667(_0x332111);})[_0x2937('0x18')](function(_0x51bec2){logger[_0x2937('0x14')]('GetVoiceQueueReport',_0x51bec2['message'],_0x1a0877);_0x59f7db(_0x3b12fb[_0x2937('0x14')](0x1f4,_0x51bec2[_0x2937('0x16')]));});});};exports[_0x2937('0x23')]=function(_0xa0b1d8){var _0x27d2cb=this;return new Promise(function(_0x362e4d,_0x2ba375){return db[_0x2937('0x1a')][_0x2937('0x24')](_0xa0b1d8[_0x2937('0x25')],{'raw':_0xa0b1d8[_0x2937('0x1c')]?_0xa0b1d8[_0x2937('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x2937('0xe')](function(_0x54916b){logger['info']('CreateVoiceQueueReport',_0xa0b1d8);logger[_0x2937('0x12')](_0x2937('0x23'),_0xa0b1d8,JSON['stringify'](_0x54916b));_0x362e4d(_0x54916b);})['catch'](function(_0x5c75e6){logger[_0x2937('0x14')](_0x2937('0x23'),_0x5c75e6['message'],_0xa0b1d8);_0x2ba375(_0x27d2cb[_0x2937('0x14')](0x1f4,_0x5c75e6[_0x2937('0x16')]));});});};exports[_0x2937('0x26')]=function(_0x2d0512){var _0x82eeac=this;return new Promise(function(_0x4ee051,_0x1b001d){return db[_0x2937('0x1a')][_0x2937('0x27')](_0x2d0512[_0x2937('0x25')],{'raw':_0x2d0512[_0x2937('0x1c')]?_0x2d0512[_0x2937('0x1c')][_0x2937('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d0512[_0x2937('0x1c')]?_0x2d0512[_0x2937('0x1c')][_0x2937('0x1e')]||null:null,'attributes':_0x2d0512[_0x2937('0x1c')]?_0x2d0512[_0x2937('0x1c')]['attributes']||null:null,'limit':_0x2d0512[_0x2937('0x1c')]?_0x2d0512['options'][_0x2937('0x28')]||null:null})[_0x2937('0xe')](function(_0x290b79){logger[_0x2937('0xf')](_0x2937('0x26'),_0x2d0512);logger['debug'](_0x2937('0x26'),_0x2d0512,JSON[_0x2937('0x13')](_0x290b79));_0x4ee051(_0x290b79);})[_0x2937('0x18')](function(_0xdd92cc){logger[_0x2937('0x14')]('UpdateVoiceQueueReport',_0xdd92cc[_0x2937('0x16')],_0x2d0512);_0x1b001d(_0x82eeac[_0x2937('0x14')](0x1f4,_0xdd92cc['message']));});});};