8616bf92de67860fd5014f7104ff211f4b1fede9
[motion2.git] / server / api / dashboardItem / dashboardItem.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 _0xca32=['error','DashboardItem,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xca32,0x81));var _0x2ca3=function(_0x413ac5,_0x3d68ae){_0x413ac5=_0x413ac5-0x0;var _0x4ef88e=_0xca32[_0x413ac5];return _0x4ef88e;};'use strict';var _=require(_0x2ca3('0x0'));var util=require(_0x2ca3('0x1'));var moment=require(_0x2ca3('0x2'));var BPromise=require(_0x2ca3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ca3('0x4'))['db'];var utils=require(_0x2ca3('0x5'));var logger=require(_0x2ca3('0x6'))(_0x2ca3('0x7'));var config=require(_0x2ca3('0x8'));var jayson=require(_0x2ca3('0x9'));var client=jayson[_0x2ca3('0xa')][_0x2ca3('0xb')]({'port':0x232a});config[_0x2ca3('0xc')]=_['defaults'](config[_0x2ca3('0xc')],{'host':_0x2ca3('0xd'),'port':0x18eb});var socket=require(_0x2ca3('0xe'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x2ca3('0xf')](socket);function respondWithRpcPromise(_0x1f0f64,_0x24f2f1,_0x2cfe99){return new BPromise(function(_0x15f4b5,_0x14394c){return client[_0x2ca3('0x10')](_0x1f0f64,_0x2cfe99)['then'](function(_0x53ff46){logger[_0x2ca3('0x11')]('DashboardItem,\x20%s,\x20%s',_0x24f2f1,_0x2ca3('0x12'));logger[_0x2ca3('0x13')](_0x2ca3('0x14'),_0x24f2f1,'request\x20sent',JSON['stringify'](_0x53ff46));if(_0x53ff46[_0x2ca3('0x15')]){if(_0x53ff46[_0x2ca3('0x15')]['code']===0x1f4){logger['error'](_0x2ca3('0x16'),_0x24f2f1,_0x53ff46['error'][_0x2ca3('0x17')]);return _0x14394c(_0x53ff46['error'][_0x2ca3('0x17')]);}logger[_0x2ca3('0x15')]('DashboardItem,\x20%s,\x20%s',_0x24f2f1,_0x53ff46[_0x2ca3('0x15')][_0x2ca3('0x17')]);return _0x15f4b5(_0x53ff46['error'][_0x2ca3('0x17')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x24f2f1,'request\x20sent');_0x15f4b5(_0x53ff46['result'][_0x2ca3('0x17')]);}})[_0x2ca3('0x18')](function(_0x3dc32f){logger[_0x2ca3('0x15')](_0x2ca3('0x16'),_0x24f2f1,_0x3dc32f);_0x14394c(_0x3dc32f);});});}