Built motion from commit (unavailable).|2.5.0
[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 _0x7a0c=['VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','debug','catch','create','body','CreateVoiceQueueReport','update','where','UpdateVoiceQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info'];(function(_0x5e9aa2,_0xd197ca){var _0xc42277=function(_0xbda71a){while(--_0xbda71a){_0x5e9aa2['push'](_0x5e9aa2['shift']());}};_0xc42277(++_0xd197ca);}(_0x7a0c,0x1e5));var _0xc7a0=function(_0x3aa30d,_0x1b1fa9){_0x3aa30d=_0x3aa30d-0x0;var _0x4fe3a6=_0x7a0c[_0x3aa30d];return _0x4fe3a6;};'use strict';var _=require(_0xc7a0('0x0'));var util=require(_0xc7a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc7a0('0x2'));var fs=require('fs');var Redis=require(_0xc7a0('0x3'));var db=require(_0xc7a0('0x4'))['db'];var utils=require(_0xc7a0('0x5'));var logger=require(_0xc7a0('0x6'))(_0xc7a0('0x7'));var config=require(_0xc7a0('0x8'));var jayson=require(_0xc7a0('0x9'));var client=jayson[_0xc7a0('0xa')][_0xc7a0('0xb')]({'port':0x232a});config['redis']=_[_0xc7a0('0xc')](config[_0xc7a0('0xd')],{'host':_0xc7a0('0xe'),'port':0x18eb});var socket=require(_0xc7a0('0xf'))(new Redis(config[_0xc7a0('0xd')]));require(_0xc7a0('0x10'))[_0xc7a0('0x11')](socket);function respondWithRpcPromise(_0x4d0355,_0x39c55f,_0x5e2061){return new BPromise(function(_0x153e3a,_0x325176){return client[_0xc7a0('0x12')](_0x4d0355,_0x5e2061)[_0xc7a0('0x13')](function(_0x549f39){logger[_0xc7a0('0x14')](_0xc7a0('0x15'),_0x39c55f,'request\x20sent');logger['debug'](_0xc7a0('0x16'),_0x39c55f,_0xc7a0('0x17'),JSON[_0xc7a0('0x18')](_0x549f39));if(_0x549f39[_0xc7a0('0x19')]){if(_0x549f39[_0xc7a0('0x19')][_0xc7a0('0x1a')]===0x1f4){logger['error'](_0xc7a0('0x15'),_0x39c55f,_0x549f39['error']['message']);return _0x325176(_0x549f39[_0xc7a0('0x19')][_0xc7a0('0x1b')]);}logger[_0xc7a0('0x19')](_0xc7a0('0x15'),_0x39c55f,_0x549f39[_0xc7a0('0x19')][_0xc7a0('0x1b')]);return _0x153e3a(_0x549f39[_0xc7a0('0x19')][_0xc7a0('0x1b')]);}else{logger[_0xc7a0('0x14')](_0xc7a0('0x15'),_0x39c55f,'request\x20sent');_0x153e3a(_0x549f39['result']['message']);}})['catch'](function(_0x14a5b4){logger[_0xc7a0('0x19')](_0xc7a0('0x15'),_0x39c55f,_0x14a5b4);_0x325176(_0x14a5b4);});});}exports[_0xc7a0('0x1c')]=function(_0x246e24){var _0x1027de=this;return new Promise(function(_0x281129,_0x2b0f89){return db[_0xc7a0('0x1d')][_0xc7a0('0x1e')]({'raw':_0x246e24[_0xc7a0('0x1f')]?_0x246e24['options'][_0xc7a0('0x20')]===undefined?!![]:![]:!![],'where':_0x246e24[_0xc7a0('0x1f')]?_0x246e24[_0xc7a0('0x1f')]['where']||null:null,'attributes':_0x246e24[_0xc7a0('0x1f')]?_0x246e24[_0xc7a0('0x1f')][_0xc7a0('0x21')]||null:null,'limit':_0x246e24[_0xc7a0('0x1f')]?_0x246e24[_0xc7a0('0x1f')][_0xc7a0('0x22')]||null:null,'include':_0x246e24[_0xc7a0('0x1f')]?_0x246e24[_0xc7a0('0x1f')][_0xc7a0('0x23')]?_[_0xc7a0('0x24')](_0x246e24[_0xc7a0('0x1f')][_0xc7a0('0x23')],function(_0x23bac3){return{'model':db[_0x23bac3['model']],'as':_0x23bac3['as'],'attributes':_0x23bac3[_0xc7a0('0x21')],'include':_0x23bac3[_0xc7a0('0x23')]?_[_0xc7a0('0x24')](_0x23bac3[_0xc7a0('0x23')],function(_0x2bd05d){return{'model':db[_0x2bd05d['model']],'as':_0x2bd05d['as'],'attributes':_0x2bd05d[_0xc7a0('0x21')],'include':_0x2bd05d[_0xc7a0('0x23')]?_[_0xc7a0('0x24')](_0x2bd05d[_0xc7a0('0x23')],function(_0x21d45c){return{'model':db[_0x21d45c[_0xc7a0('0x25')]],'as':_0x21d45c['as'],'attributes':_0x21d45c[_0xc7a0('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc7a0('0x13')](function(_0x1386bf){logger[_0xc7a0('0x14')](_0xc7a0('0x1c'),_0x246e24);logger[_0xc7a0('0x26')](_0xc7a0('0x1c'),_0x246e24,JSON[_0xc7a0('0x18')](_0x1386bf));_0x281129(_0x1386bf);})[_0xc7a0('0x27')](function(_0x1106be){logger['error'](_0xc7a0('0x1c'),_0x1106be[_0xc7a0('0x1b')],_0x246e24);_0x2b0f89(_0x1027de[_0xc7a0('0x19')](0x1f4,_0x1106be[_0xc7a0('0x1b')]));});});};exports['CreateVoiceQueueReport']=function(_0x530a77){var _0x246bca=this;return new Promise(function(_0x207502,_0x3d0f11){return db['VoiceQueueReport'][_0xc7a0('0x28')](_0x530a77[_0xc7a0('0x29')],{'raw':_0x530a77[_0xc7a0('0x1f')]?_0x530a77['options'][_0xc7a0('0x20')]===undefined?!![]:![]:!![]})[_0xc7a0('0x13')](function(_0x5a0a18){logger[_0xc7a0('0x14')]('CreateVoiceQueueReport',_0x530a77);logger[_0xc7a0('0x26')](_0xc7a0('0x2a'),_0x530a77,JSON['stringify'](_0x5a0a18));_0x207502(_0x5a0a18);})[_0xc7a0('0x27')](function(_0xfff90c){logger['error']('CreateVoiceQueueReport',_0xfff90c[_0xc7a0('0x1b')],_0x530a77);_0x3d0f11(_0x246bca['error'](0x1f4,_0xfff90c[_0xc7a0('0x1b')]));});});};exports['UpdateVoiceQueueReport']=function(_0x35b6f4){var _0x2d47f8=this;return new Promise(function(_0x408087,_0x5e27b4){return db[_0xc7a0('0x1d')][_0xc7a0('0x2b')](_0x35b6f4[_0xc7a0('0x29')],{'raw':_0x35b6f4[_0xc7a0('0x1f')]?_0x35b6f4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35b6f4['options']?_0x35b6f4[_0xc7a0('0x1f')][_0xc7a0('0x2c')]||null:null,'attributes':_0x35b6f4[_0xc7a0('0x1f')]?_0x35b6f4[_0xc7a0('0x1f')][_0xc7a0('0x21')]||null:null,'limit':_0x35b6f4[_0xc7a0('0x1f')]?_0x35b6f4[_0xc7a0('0x1f')][_0xc7a0('0x22')]||null:null})['then'](function(_0xbe7b7c){logger[_0xc7a0('0x14')](_0xc7a0('0x2d'),_0x35b6f4);logger[_0xc7a0('0x26')](_0xc7a0('0x2d'),_0x35b6f4,JSON[_0xc7a0('0x18')](_0xbe7b7c));_0x408087(_0xbe7b7c);})[_0xc7a0('0x27')](function(_0x20e719){logger[_0xc7a0('0x19')](_0xc7a0('0x2d'),_0x20e719[_0xc7a0('0x1b')],_0x35b6f4);_0x5e27b4(_0x2d47f8[_0xc7a0('0x19')](0x1f4,_0x20e719[_0xc7a0('0x1b')]));});});};