Built motion from commit 67e5df37.|2.0.68
[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 _0xb16f=['debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueReport','findAll','options','where','limit','include','map','model','attributes','VoiceQueueReport','create','body','raw','CreateVoiceQueueReport','catch','UpdateVoiceQueueReport','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','http','socket.io-emitter','localhost','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x333b25,_0x47ff12){var _0x25586f=function(_0x1263a5){while(--_0x1263a5){_0x333b25['push'](_0x333b25['shift']());}};_0x25586f(++_0x47ff12);}(_0xb16f,0x1c4));var _0xfb16=function(_0x22b70f,_0x4c853f){_0x22b70f=_0x22b70f-0x0;var _0x100985=_0xb16f[_0x22b70f];return _0x100985;};'use strict';var _=require('lodash');var util=require(_0xfb16('0x0'));var moment=require(_0xfb16('0x1'));var BPromise=require(_0xfb16('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xfb16('0x3'))['db'];var utils=require(_0xfb16('0x4'));var logger=require('../../config/logger')(_0xfb16('0x5'));var config=require('../../config/environment');var jayson=require(_0xfb16('0x6'));var client=jayson['client'][_0xfb16('0x7')]({'port':0x232a});var socket=require(_0xfb16('0x8'))({'host':_0xfb16('0x9'),'port':0x18eb});require(_0xfb16('0xa'))['register'](socket);function respondWithRpcPromise(_0x362b89,_0x375f48,_0x3e812a){return new BPromise(function(_0x496d1b,_0x1d7dcc){return client[_0xfb16('0xb')](_0x362b89,_0x3e812a)[_0xfb16('0xc')](function(_0x1a564b){logger[_0xfb16('0xd')](_0xfb16('0xe'),_0x375f48,_0xfb16('0xf'));logger[_0xfb16('0x10')](_0xfb16('0x11'),_0x375f48,_0xfb16('0xf'),JSON[_0xfb16('0x12')](_0x1a564b));if(_0x1a564b[_0xfb16('0x13')]){if(_0x1a564b[_0xfb16('0x13')][_0xfb16('0x14')]===0x1f4){logger[_0xfb16('0x13')](_0xfb16('0xe'),_0x375f48,_0x1a564b['error'][_0xfb16('0x15')]);return _0x1d7dcc(_0x1a564b['error'][_0xfb16('0x15')]);}logger['error'](_0xfb16('0xe'),_0x375f48,_0x1a564b[_0xfb16('0x13')][_0xfb16('0x15')]);return _0x496d1b(_0x1a564b[_0xfb16('0x13')][_0xfb16('0x15')]);}else{logger[_0xfb16('0xd')](_0xfb16('0xe'),_0x375f48,'request\x20sent');_0x496d1b(_0x1a564b[_0xfb16('0x16')]['message']);}})['catch'](function(_0x5efe82){logger[_0xfb16('0x13')](_0xfb16('0xe'),_0x375f48,_0x5efe82);_0x1d7dcc(_0x5efe82);});});}exports[_0xfb16('0x17')]=function(_0x5db146){var _0x132c6f=this;return new Promise(function(_0x469a10,_0x486021){return db['VoiceQueueReport'][_0xfb16('0x18')]({'raw':_0x5db146['options']?_0x5db146[_0xfb16('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5db146[_0xfb16('0x19')]?_0x5db146['options'][_0xfb16('0x1a')]||null:null,'attributes':_0x5db146[_0xfb16('0x19')]?_0x5db146[_0xfb16('0x19')]['attributes']||null:null,'limit':_0x5db146[_0xfb16('0x19')]?_0x5db146[_0xfb16('0x19')][_0xfb16('0x1b')]||null:null,'include':_0x5db146[_0xfb16('0x19')]?_0x5db146[_0xfb16('0x19')][_0xfb16('0x1c')]?_[_0xfb16('0x1d')](_0x5db146['options'][_0xfb16('0x1c')],function(_0x16b7b6){return{'model':db[_0x16b7b6[_0xfb16('0x1e')]],'as':_0x16b7b6['as'],'attributes':_0x16b7b6[_0xfb16('0x1f')],'include':_0x16b7b6[_0xfb16('0x1c')]?_[_0xfb16('0x1d')](_0x16b7b6['include'],function(_0x498525){return{'model':db[_0x498525[_0xfb16('0x1e')]],'as':_0x498525['as'],'attributes':_0x498525[_0xfb16('0x1f')],'include':_0x498525[_0xfb16('0x1c')]?_[_0xfb16('0x1d')](_0x498525[_0xfb16('0x1c')],function(_0x564a58){return{'model':db[_0x564a58[_0xfb16('0x1e')]],'as':_0x564a58['as'],'attributes':_0x564a58[_0xfb16('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfb16('0xc')](function(_0x2082f4){logger[_0xfb16('0xd')](_0xfb16('0x17'),_0x5db146);logger[_0xfb16('0x10')](_0xfb16('0x17'),_0x5db146,JSON[_0xfb16('0x12')](_0x2082f4));_0x469a10(_0x2082f4);})['catch'](function(_0x55198e){logger[_0xfb16('0x13')]('GetVoiceQueueReport',_0x55198e[_0xfb16('0x15')],_0x5db146);_0x486021(_0x132c6f[_0xfb16('0x13')](0x1f4,_0x55198e[_0xfb16('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0xc3520d){var _0x40ed96=this;return new Promise(function(_0xd86d8e,_0x27f9ec){return db[_0xfb16('0x20')][_0xfb16('0x21')](_0xc3520d[_0xfb16('0x22')],{'raw':_0xc3520d[_0xfb16('0x19')]?_0xc3520d['options'][_0xfb16('0x23')]===undefined?!![]:![]:!![]})[_0xfb16('0xc')](function(_0x2d124a){logger[_0xfb16('0xd')](_0xfb16('0x24'),_0xc3520d);logger[_0xfb16('0x10')](_0xfb16('0x24'),_0xc3520d,JSON[_0xfb16('0x12')](_0x2d124a));_0xd86d8e(_0x2d124a);})[_0xfb16('0x25')](function(_0x435e33){logger[_0xfb16('0x13')](_0xfb16('0x24'),_0x435e33[_0xfb16('0x15')],_0xc3520d);_0x27f9ec(_0x40ed96[_0xfb16('0x13')](0x1f4,_0x435e33[_0xfb16('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x31983a){var _0x395dcc=this;return new Promise(function(_0x4ab146,_0x14d16f){return db[_0xfb16('0x20')]['update'](_0x31983a[_0xfb16('0x22')],{'raw':_0x31983a[_0xfb16('0x19')]?_0x31983a[_0xfb16('0x19')][_0xfb16('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31983a[_0xfb16('0x19')]?_0x31983a[_0xfb16('0x19')]['where']||null:null,'attributes':_0x31983a[_0xfb16('0x19')]?_0x31983a[_0xfb16('0x19')][_0xfb16('0x1f')]||null:null,'limit':_0x31983a['options']?_0x31983a['options'][_0xfb16('0x1b')]||null:null})[_0xfb16('0xc')](function(_0x1f2a3e){logger[_0xfb16('0xd')]('UpdateVoiceQueueReport',_0x31983a);logger[_0xfb16('0x10')](_0xfb16('0x26'),_0x31983a,JSON['stringify'](_0x1f2a3e));_0x4ab146(_0x1f2a3e);})[_0xfb16('0x25')](function(_0x2cb822){logger[_0xfb16('0x13')](_0xfb16('0x26'),_0x2cb822[_0xfb16('0x15')],_0x31983a);_0x14d16f(_0x395dcc[_0xfb16('0x13')](0x1f4,_0x2cb822[_0xfb16('0x15')]));});});};