248e7af2aae41bc4fe33e2c95a7028834b292409
[motion2.git] / server / api / dashboard / dashboard.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 _0x3060=['Dashboard,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','info','Dashboard,\x20%s,\x20%s','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3060,0xd5));var _0x0306=function(_0x2e9556,_0x5d18fb){_0x2e9556=_0x2e9556-0x0;var _0x1d4a1f=_0x3060[_0x2e9556];return _0x1d4a1f;};'use strict';var _=require(_0x0306('0x0'));var util=require(_0x0306('0x1'));var moment=require(_0x0306('0x2'));var BPromise=require(_0x0306('0x3'));var rs=require(_0x0306('0x4'));var fs=require('fs');var Redis=require(_0x0306('0x5'));var db=require(_0x0306('0x6'))['db'];var utils=require(_0x0306('0x7'));var logger=require(_0x0306('0x8'))(_0x0306('0x9'));var config=require(_0x0306('0xa'));var jayson=require(_0x0306('0xb'));var client=jayson['client'][_0x0306('0xc')]({'port':0x232a});config['redis']=_[_0x0306('0xd')](config[_0x0306('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x0306('0xf'))(new Redis(config[_0x0306('0xe')]));require('./dashboard.socket')[_0x0306('0x10')](socket);function respondWithRpcPromise(_0x299d03,_0x58f286,_0x30a284){return new BPromise(function(_0x50951f,_0x3cd81f){return client[_0x0306('0x11')](_0x299d03,_0x30a284)['then'](function(_0x24ceff){logger[_0x0306('0x12')](_0x0306('0x13'),_0x58f286,'request\x20sent');logger[_0x0306('0x14')](_0x0306('0x15'),_0x58f286,'request\x20sent',JSON['stringify'](_0x24ceff));if(_0x24ceff[_0x0306('0x16')]){if(_0x24ceff[_0x0306('0x16')]['code']===0x1f4){logger[_0x0306('0x16')]('Dashboard,\x20%s,\x20%s',_0x58f286,_0x24ceff[_0x0306('0x16')][_0x0306('0x17')]);return _0x3cd81f(_0x24ceff[_0x0306('0x16')][_0x0306('0x17')]);}logger[_0x0306('0x16')]('Dashboard,\x20%s,\x20%s',_0x58f286,_0x24ceff[_0x0306('0x16')][_0x0306('0x17')]);return _0x50951f(_0x24ceff[_0x0306('0x16')][_0x0306('0x17')]);}else{logger['info'](_0x0306('0x13'),_0x58f286,_0x0306('0x18'));_0x50951f(_0x24ceff['result']['message']);}})[_0x0306('0x19')](function(_0x45fd18){logger[_0x0306('0x16')]('Dashboard,\x20%s,\x20%s',_0x58f286,_0x45fd18);_0x3cd81f(_0x45fd18);});});}