Built motion from commit (unavailable).|2.0.78
[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 _0x78cb=['register','request','then','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','VoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes','info','GetVoiceQueueReport','CreateVoiceQueueReport','catch','UpdateVoiceQueueReport','update','body','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./voiceQueueReport.socket'];(function(_0x5bd9c9,_0x31fc54){var _0x6bf767=function(_0x1cc503){while(--_0x1cc503){_0x5bd9c9['push'](_0x5bd9c9['shift']());}};_0x6bf767(++_0x31fc54);}(_0x78cb,0x9e));var _0xb78c=function(_0x2ae9f1,_0x12aca9){_0x2ae9f1=_0x2ae9f1-0x0;var _0x327a64=_0x78cb[_0x2ae9f1];return _0x327a64;};'use strict';var _=require(_0xb78c('0x0'));var util=require(_0xb78c('0x1'));var moment=require(_0xb78c('0x2'));var BPromise=require(_0xb78c('0x3'));var rs=require(_0xb78c('0x4'));var fs=require('fs');var db=require(_0xb78c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb78c('0x6'));var config=require(_0xb78c('0x7'));var jayson=require(_0xb78c('0x8'));var client=jayson[_0xb78c('0x9')][_0xb78c('0xa')]({'port':0x232a});var socket=require(_0xb78c('0xb'))({'host':_0xb78c('0xc'),'port':0x18eb});require(_0xb78c('0xd'))[_0xb78c('0xe')](socket);function respondWithRpcPromise(_0x4f4418,_0x213ea5,_0xe9f87a){return new BPromise(function(_0x10a637,_0x3090a7){return client[_0xb78c('0xf')](_0x4f4418,_0xe9f87a)[_0xb78c('0x10')](function(_0x3a5b90){logger['info'](_0xb78c('0x11'),_0x213ea5,'request\x20sent');logger[_0xb78c('0x12')](_0xb78c('0x13'),_0x213ea5,'request\x20sent',JSON[_0xb78c('0x14')](_0x3a5b90));if(_0x3a5b90[_0xb78c('0x15')]){if(_0x3a5b90['error'][_0xb78c('0x16')]===0x1f4){logger[_0xb78c('0x15')](_0xb78c('0x11'),_0x213ea5,_0x3a5b90['error'][_0xb78c('0x17')]);return _0x3090a7(_0x3a5b90[_0xb78c('0x15')][_0xb78c('0x17')]);}logger[_0xb78c('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x213ea5,_0x3a5b90[_0xb78c('0x15')][_0xb78c('0x17')]);return _0x10a637(_0x3a5b90[_0xb78c('0x15')][_0xb78c('0x17')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x213ea5,_0xb78c('0x18'));_0x10a637(_0x3a5b90[_0xb78c('0x19')][_0xb78c('0x17')]);}})['catch'](function(_0x50927f){logger[_0xb78c('0x15')](_0xb78c('0x11'),_0x213ea5,_0x50927f);_0x3090a7(_0x50927f);});});}exports['GetVoiceQueueReport']=function(_0x5ebd84){var _0x53d797=this;return new Promise(function(_0xe29d1,_0x36dd59){return db[_0xb78c('0x1a')][_0xb78c('0x1b')]({'raw':_0x5ebd84[_0xb78c('0x1c')]?_0x5ebd84['options'][_0xb78c('0x1d')]===undefined?!![]:![]:!![],'where':_0x5ebd84[_0xb78c('0x1c')]?_0x5ebd84[_0xb78c('0x1c')][_0xb78c('0x1e')]||null:null,'attributes':_0x5ebd84['options']?_0x5ebd84[_0xb78c('0x1c')]['attributes']||null:null,'limit':_0x5ebd84[_0xb78c('0x1c')]?_0x5ebd84['options'][_0xb78c('0x1f')]||null:null,'include':_0x5ebd84['options']?_0x5ebd84['options'][_0xb78c('0x20')]?_[_0xb78c('0x21')](_0x5ebd84[_0xb78c('0x1c')][_0xb78c('0x20')],function(_0x5c87a8){return{'model':db[_0x5c87a8[_0xb78c('0x22')]],'as':_0x5c87a8['as'],'attributes':_0x5c87a8[_0xb78c('0x23')],'include':_0x5c87a8['include']?_[_0xb78c('0x21')](_0x5c87a8['include'],function(_0x4e6b1a){return{'model':db[_0x4e6b1a[_0xb78c('0x22')]],'as':_0x4e6b1a['as'],'attributes':_0x4e6b1a[_0xb78c('0x23')],'include':_0x4e6b1a[_0xb78c('0x20')]?_[_0xb78c('0x21')](_0x4e6b1a[_0xb78c('0x20')],function(_0x42c384){return{'model':db[_0x42c384[_0xb78c('0x22')]],'as':_0x42c384['as'],'attributes':_0x42c384[_0xb78c('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb78c('0x10')](function(_0x2d50e3){logger[_0xb78c('0x24')](_0xb78c('0x25'),_0x5ebd84);logger[_0xb78c('0x12')](_0xb78c('0x25'),_0x5ebd84,JSON[_0xb78c('0x14')](_0x2d50e3));_0xe29d1(_0x2d50e3);})['catch'](function(_0x5643d8){logger[_0xb78c('0x15')]('GetVoiceQueueReport',_0x5643d8[_0xb78c('0x17')],_0x5ebd84);_0x36dd59(_0x53d797[_0xb78c('0x15')](0x1f4,_0x5643d8[_0xb78c('0x17')]));});});};exports[_0xb78c('0x26')]=function(_0x3334a4){var _0x5422d3=this;return new Promise(function(_0x56e293,_0x70818b){return db[_0xb78c('0x1a')]['create'](_0x3334a4['body'],{'raw':_0x3334a4[_0xb78c('0x1c')]?_0x3334a4[_0xb78c('0x1c')][_0xb78c('0x1d')]===undefined?!![]:![]:!![]})[_0xb78c('0x10')](function(_0xd131c4){logger[_0xb78c('0x24')](_0xb78c('0x26'),_0x3334a4);logger['debug'](_0xb78c('0x26'),_0x3334a4,JSON['stringify'](_0xd131c4));_0x56e293(_0xd131c4);})[_0xb78c('0x27')](function(_0x347709){logger['error'](_0xb78c('0x26'),_0x347709[_0xb78c('0x17')],_0x3334a4);_0x70818b(_0x5422d3[_0xb78c('0x15')](0x1f4,_0x347709['message']));});});};exports[_0xb78c('0x28')]=function(_0x30d41c){var _0x234ca1=this;return new Promise(function(_0x2f2f2d,_0x59ed22){return db['VoiceQueueReport'][_0xb78c('0x29')](_0x30d41c[_0xb78c('0x2a')],{'raw':_0x30d41c[_0xb78c('0x1c')]?_0x30d41c[_0xb78c('0x1c')][_0xb78c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30d41c['options']?_0x30d41c[_0xb78c('0x1c')][_0xb78c('0x1e')]||null:null,'attributes':_0x30d41c[_0xb78c('0x1c')]?_0x30d41c[_0xb78c('0x1c')][_0xb78c('0x23')]||null:null,'limit':_0x30d41c[_0xb78c('0x1c')]?_0x30d41c[_0xb78c('0x1c')]['limit']||null:null})['then'](function(_0x3135ef){logger[_0xb78c('0x24')](_0xb78c('0x28'),_0x30d41c);logger[_0xb78c('0x12')](_0xb78c('0x28'),_0x30d41c,JSON['stringify'](_0x3135ef));_0x2f2f2d(_0x3135ef);})[_0xb78c('0x27')](function(_0x507893){logger['error'](_0xb78c('0x28'),_0x507893[_0xb78c('0x17')],_0x30d41c);_0x59ed22(_0x234ca1[_0xb78c('0x15')](0x1f4,_0x507893['message']));});});};