Built motion from commit (unavailable).|2.5.4
[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 _0x4a59=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','limit'];(function(_0x4997b0,_0x593ebd){var _0x566238=function(_0x40231b){while(--_0x40231b){_0x4997b0['push'](_0x4997b0['shift']());}};_0x566238(++_0x593ebd);}(_0x4a59,0x10e));var _0x94a5=function(_0x4e7c5e,_0x369004){_0x4e7c5e=_0x4e7c5e-0x0;var _0x1ec6fa=_0x4a59[_0x4e7c5e];return _0x1ec6fa;};'use strict';var _=require(_0x94a5('0x0'));var util=require(_0x94a5('0x1'));var moment=require(_0x94a5('0x2'));var BPromise=require(_0x94a5('0x3'));var rs=require(_0x94a5('0x4'));var fs=require('fs');var Redis=require(_0x94a5('0x5'));var db=require(_0x94a5('0x6'))['db'];var utils=require(_0x94a5('0x7'));var logger=require(_0x94a5('0x8'))(_0x94a5('0x9'));var config=require(_0x94a5('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x94a5('0xb')][_0x94a5('0xc')]({'port':0x232a});config['redis']=_[_0x94a5('0xd')](config[_0x94a5('0xe')],{'host':_0x94a5('0xf'),'port':0x18eb});var socket=require(_0x94a5('0x10'))(new Redis(config[_0x94a5('0xe')]));require(_0x94a5('0x11'))['register'](socket);function respondWithRpcPromise(_0x576476,_0x331a54,_0x483898){return new BPromise(function(_0x5b5fc7,_0x128ea7){return client[_0x94a5('0x12')](_0x576476,_0x483898)[_0x94a5('0x13')](function(_0x24d850){logger[_0x94a5('0x14')](_0x94a5('0x15'),_0x331a54,_0x94a5('0x16'));logger[_0x94a5('0x17')](_0x94a5('0x18'),_0x331a54,_0x94a5('0x16'),JSON[_0x94a5('0x19')](_0x24d850));if(_0x24d850[_0x94a5('0x1a')]){if(_0x24d850[_0x94a5('0x1a')]['code']===0x1f4){logger[_0x94a5('0x1a')]('VoiceQueueReport,\x20%s,\x20%s',_0x331a54,_0x24d850[_0x94a5('0x1a')][_0x94a5('0x1b')]);return _0x128ea7(_0x24d850['error'][_0x94a5('0x1b')]);}logger[_0x94a5('0x1a')](_0x94a5('0x15'),_0x331a54,_0x24d850[_0x94a5('0x1a')][_0x94a5('0x1b')]);return _0x5b5fc7(_0x24d850[_0x94a5('0x1a')][_0x94a5('0x1b')]);}else{logger[_0x94a5('0x14')](_0x94a5('0x15'),_0x331a54,'request\x20sent');_0x5b5fc7(_0x24d850[_0x94a5('0x1c')]['message']);}})[_0x94a5('0x1d')](function(_0x17a0e3){logger[_0x94a5('0x1a')]('VoiceQueueReport,\x20%s,\x20%s',_0x331a54,_0x17a0e3);_0x128ea7(_0x17a0e3);});});}exports[_0x94a5('0x1e')]=function(_0x53737d){var _0x38202d=this;return new Promise(function(_0x1db45f,_0x4054bd){return db[_0x94a5('0x1f')][_0x94a5('0x20')]({'raw':_0x53737d[_0x94a5('0x21')]?_0x53737d['options'][_0x94a5('0x22')]===undefined?!![]:![]:!![],'where':_0x53737d[_0x94a5('0x21')]?_0x53737d[_0x94a5('0x21')][_0x94a5('0x23')]||null:null,'attributes':_0x53737d['options']?_0x53737d[_0x94a5('0x21')][_0x94a5('0x24')]||null:null,'limit':_0x53737d[_0x94a5('0x21')]?_0x53737d[_0x94a5('0x21')]['limit']||null:null,'include':_0x53737d[_0x94a5('0x21')]?_0x53737d[_0x94a5('0x21')]['include']?_['map'](_0x53737d[_0x94a5('0x21')][_0x94a5('0x25')],function(_0x180be6){return{'model':db[_0x180be6['model']],'as':_0x180be6['as'],'attributes':_0x180be6['attributes'],'include':_0x180be6[_0x94a5('0x25')]?_[_0x94a5('0x26')](_0x180be6[_0x94a5('0x25')],function(_0x5e3097){return{'model':db[_0x5e3097['model']],'as':_0x5e3097['as'],'attributes':_0x5e3097[_0x94a5('0x24')],'include':_0x5e3097[_0x94a5('0x25')]?_['map'](_0x5e3097[_0x94a5('0x25')],function(_0x438830){return{'model':db[_0x438830[_0x94a5('0x27')]],'as':_0x438830['as'],'attributes':_0x438830[_0x94a5('0x24')]};}):[]};}):[]};}):[]:[]})[_0x94a5('0x13')](function(_0x5148bd){logger[_0x94a5('0x14')](_0x94a5('0x1e'),_0x53737d);logger[_0x94a5('0x17')]('GetVoiceQueueReport',_0x53737d,JSON[_0x94a5('0x19')](_0x5148bd));_0x1db45f(_0x5148bd);})[_0x94a5('0x1d')](function(_0x132c58){logger[_0x94a5('0x1a')](_0x94a5('0x1e'),_0x132c58['message'],_0x53737d);_0x4054bd(_0x38202d[_0x94a5('0x1a')](0x1f4,_0x132c58[_0x94a5('0x1b')]));});});};exports[_0x94a5('0x28')]=function(_0x231a96){var _0x115390=this;return new Promise(function(_0x259213,_0xcfdc1f){return db[_0x94a5('0x1f')]['create'](_0x231a96[_0x94a5('0x29')],{'raw':_0x231a96[_0x94a5('0x21')]?_0x231a96['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x9e699b){logger[_0x94a5('0x14')](_0x94a5('0x28'),_0x231a96);logger[_0x94a5('0x17')](_0x94a5('0x28'),_0x231a96,JSON[_0x94a5('0x19')](_0x9e699b));_0x259213(_0x9e699b);})[_0x94a5('0x1d')](function(_0x4a650d){logger['error'](_0x94a5('0x28'),_0x4a650d['message'],_0x231a96);_0xcfdc1f(_0x115390[_0x94a5('0x1a')](0x1f4,_0x4a650d[_0x94a5('0x1b')]));});});};exports[_0x94a5('0x2a')]=function(_0x2b13b6){var _0x358430=this;return new Promise(function(_0x373567,_0xc7ac2d){return db[_0x94a5('0x1f')][_0x94a5('0x2b')](_0x2b13b6[_0x94a5('0x29')],{'raw':_0x2b13b6[_0x94a5('0x21')]?_0x2b13b6['options'][_0x94a5('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b13b6[_0x94a5('0x21')]?_0x2b13b6['options'][_0x94a5('0x23')]||null:null,'attributes':_0x2b13b6[_0x94a5('0x21')]?_0x2b13b6[_0x94a5('0x21')][_0x94a5('0x24')]||null:null,'limit':_0x2b13b6[_0x94a5('0x21')]?_0x2b13b6[_0x94a5('0x21')][_0x94a5('0x2c')]||null:null})[_0x94a5('0x13')](function(_0x3c589a){logger[_0x94a5('0x14')](_0x94a5('0x2a'),_0x2b13b6);logger[_0x94a5('0x17')](_0x94a5('0x2a'),_0x2b13b6,JSON[_0x94a5('0x19')](_0x3c589a));_0x373567(_0x3c589a);})[_0x94a5('0x1d')](function(_0x346f5f){logger[_0x94a5('0x1a')]('UpdateVoiceQueueReport',_0x346f5f[_0x94a5('0x1b')],_0x2b13b6);_0xc7ac2d(_0x358430[_0x94a5('0x1a')](0x1f4,_0x346f5f['message']));});});};