Built motion from commit 775e2a94.|2.6.3
[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 _0x1654=['VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','limit','include','map','model','attributes','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','request','then','info'];(function(_0x3864fd,_0x3df174){var _0x3b977e=function(_0x4c803e){while(--_0x4c803e){_0x3864fd['push'](_0x3864fd['shift']());}};_0x3b977e(++_0x3df174);}(_0x1654,0x14d));var _0x4165=function(_0x737c93,_0x25a977){_0x737c93=_0x737c93-0x0;var _0x4d0b33=_0x1654[_0x737c93];return _0x4d0b33;};'use strict';var _=require(_0x4165('0x0'));var util=require('util');var moment=require(_0x4165('0x1'));var BPromise=require(_0x4165('0x2'));var rs=require(_0x4165('0x3'));var fs=require('fs');var Redis=require(_0x4165('0x4'));var db=require(_0x4165('0x5'))['db'];var utils=require(_0x4165('0x6'));var logger=require(_0x4165('0x7'))(_0x4165('0x8'));var config=require(_0x4165('0x9'));var jayson=require(_0x4165('0xa'));var client=jayson[_0x4165('0xb')][_0x4165('0xc')]({'port':0x232a});config[_0x4165('0xd')]=_['defaults'](config[_0x4165('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4165('0xe'))(new Redis(config[_0x4165('0xd')]));require(_0x4165('0xf'))['register'](socket);function respondWithRpcPromise(_0x32ada8,_0x22505f,_0x301aca){return new BPromise(function(_0x3248c4,_0x1005c6){return client[_0x4165('0x10')](_0x32ada8,_0x301aca)[_0x4165('0x11')](function(_0x5388c1){logger[_0x4165('0x12')](_0x4165('0x13'),_0x22505f,_0x4165('0x14'));logger[_0x4165('0x15')](_0x4165('0x16'),_0x22505f,'request\x20sent',JSON[_0x4165('0x17')](_0x5388c1));if(_0x5388c1[_0x4165('0x18')]){if(_0x5388c1[_0x4165('0x18')][_0x4165('0x19')]===0x1f4){logger['error'](_0x4165('0x13'),_0x22505f,_0x5388c1['error'][_0x4165('0x1a')]);return _0x1005c6(_0x5388c1[_0x4165('0x18')][_0x4165('0x1a')]);}logger[_0x4165('0x18')](_0x4165('0x13'),_0x22505f,_0x5388c1[_0x4165('0x18')][_0x4165('0x1a')]);return _0x3248c4(_0x5388c1[_0x4165('0x18')]['message']);}else{logger[_0x4165('0x12')](_0x4165('0x13'),_0x22505f,_0x4165('0x14'));_0x3248c4(_0x5388c1[_0x4165('0x1b')][_0x4165('0x1a')]);}})[_0x4165('0x1c')](function(_0x5b59fa){logger['error'](_0x4165('0x13'),_0x22505f,_0x5b59fa);_0x1005c6(_0x5b59fa);});});}exports[_0x4165('0x1d')]=function(_0x18b446){var _0x3f543c=this;return new Promise(function(_0x45ed1b,_0x1a6b0f){return db[_0x4165('0x1e')]['findAll']({'raw':_0x18b446[_0x4165('0x1f')]?_0x18b446[_0x4165('0x1f')][_0x4165('0x20')]===undefined?!![]:![]:!![],'where':_0x18b446[_0x4165('0x1f')]?_0x18b446[_0x4165('0x1f')][_0x4165('0x21')]||null:null,'attributes':_0x18b446['options']?_0x18b446[_0x4165('0x1f')]['attributes']||null:null,'limit':_0x18b446[_0x4165('0x1f')]?_0x18b446[_0x4165('0x1f')][_0x4165('0x22')]||null:null,'include':_0x18b446[_0x4165('0x1f')]?_0x18b446[_0x4165('0x1f')][_0x4165('0x23')]?_[_0x4165('0x24')](_0x18b446[_0x4165('0x1f')][_0x4165('0x23')],function(_0x14f16e){return{'model':db[_0x14f16e[_0x4165('0x25')]],'as':_0x14f16e['as'],'attributes':_0x14f16e[_0x4165('0x26')],'include':_0x14f16e[_0x4165('0x23')]?_[_0x4165('0x24')](_0x14f16e['include'],function(_0x5a0084){return{'model':db[_0x5a0084[_0x4165('0x25')]],'as':_0x5a0084['as'],'attributes':_0x5a0084['attributes'],'include':_0x5a0084[_0x4165('0x23')]?_['map'](_0x5a0084[_0x4165('0x23')],function(_0x3d0838){return{'model':db[_0x3d0838[_0x4165('0x25')]],'as':_0x3d0838['as'],'attributes':_0x3d0838[_0x4165('0x26')]};}):[]};}):[]};}):[]:[]})[_0x4165('0x11')](function(_0x2db7b9){logger[_0x4165('0x12')]('GetVoiceQueueReport',_0x18b446);logger['debug'](_0x4165('0x1d'),_0x18b446,JSON['stringify'](_0x2db7b9));_0x45ed1b(_0x2db7b9);})['catch'](function(_0x22ff1a){logger['error'](_0x4165('0x1d'),_0x22ff1a[_0x4165('0x1a')],_0x18b446);_0x1a6b0f(_0x3f543c[_0x4165('0x18')](0x1f4,_0x22ff1a[_0x4165('0x1a')]));});});};exports[_0x4165('0x27')]=function(_0x5b01b0){var _0xce839c=this;return new Promise(function(_0x3b9e78,_0x340e7a){return db[_0x4165('0x1e')][_0x4165('0x28')](_0x5b01b0[_0x4165('0x29')],{'raw':_0x5b01b0[_0x4165('0x1f')]?_0x5b01b0['options']['raw']===undefined?!![]:![]:!![]})[_0x4165('0x11')](function(_0x4a5770){logger[_0x4165('0x12')]('CreateVoiceQueueReport',_0x5b01b0);logger['debug'](_0x4165('0x27'),_0x5b01b0,JSON['stringify'](_0x4a5770));_0x3b9e78(_0x4a5770);})[_0x4165('0x1c')](function(_0xccc290){logger[_0x4165('0x18')](_0x4165('0x27'),_0xccc290[_0x4165('0x1a')],_0x5b01b0);_0x340e7a(_0xce839c[_0x4165('0x18')](0x1f4,_0xccc290['message']));});});};exports[_0x4165('0x2a')]=function(_0x640b47){var _0x2183bc=this;return new Promise(function(_0x22e692,_0x25018b){return db[_0x4165('0x1e')][_0x4165('0x2b')](_0x640b47['body'],{'raw':_0x640b47[_0x4165('0x1f')]?_0x640b47[_0x4165('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x640b47['options']?_0x640b47[_0x4165('0x1f')][_0x4165('0x21')]||null:null,'attributes':_0x640b47[_0x4165('0x1f')]?_0x640b47[_0x4165('0x1f')][_0x4165('0x26')]||null:null,'limit':_0x640b47[_0x4165('0x1f')]?_0x640b47[_0x4165('0x1f')]['limit']||null:null})['then'](function(_0x9e3cc){logger[_0x4165('0x12')]('UpdateVoiceQueueReport',_0x640b47);logger['debug'](_0x4165('0x2a'),_0x640b47,JSON['stringify'](_0x9e3cc));_0x22e692(_0x9e3cc);})['catch'](function(_0x2d0d6b){logger[_0x4165('0x18')](_0x4165('0x2a'),_0x2d0d6b['message'],_0x640b47);_0x25018b(_0x2183bc['error'](0x1f4,_0x2d0d6b[_0x4165('0x1a')]));});});};