3f38e39c0603bb36804c2f28ca48b32354937aea
[motion2.git] / server / api / team / team.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 _0x39cc=['request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s'];(function(_0x708c47,_0x6eaa1f){var _0x52a470=function(_0x14a750){while(--_0x14a750){_0x708c47['push'](_0x708c47['shift']());}};_0x52a470(++_0x6eaa1f);}(_0x39cc,0x104));var _0xc39c=function(_0x88be7b,_0x2403af){_0x88be7b=_0x88be7b-0x0;var _0x100b31=_0x39cc[_0x88be7b];return _0x100b31;};'use strict';var _=require(_0xc39c('0x0'));var util=require(_0xc39c('0x1'));var moment=require(_0xc39c('0x2'));var BPromise=require('bluebird');var rs=require(_0xc39c('0x3'));var fs=require('fs');var Redis=require(_0xc39c('0x4'));var db=require(_0xc39c('0x5'))['db'];var utils=require(_0xc39c('0x6'));var logger=require('../../config/logger')(_0xc39c('0x7'));var config=require(_0xc39c('0x8'));var jayson=require(_0xc39c('0x9'));var client=jayson[_0xc39c('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xc39c('0xb')],{'host':_0xc39c('0xc'),'port':0x18eb});var socket=require(_0xc39c('0xd'))(new Redis(config[_0xc39c('0xb')]));require(_0xc39c('0xe'))[_0xc39c('0xf')](socket);function respondWithRpcPromise(_0x568295,_0x5aa8c2,_0x3b6021){return new BPromise(function(_0x2923be,_0x1b8892){return client[_0xc39c('0x10')](_0x568295,_0x3b6021)[_0xc39c('0x11')](function(_0x4e2839){logger[_0xc39c('0x12')](_0xc39c('0x13'),_0x5aa8c2,_0xc39c('0x14'));logger[_0xc39c('0x15')](_0xc39c('0x16'),_0x5aa8c2,_0xc39c('0x14'),JSON[_0xc39c('0x17')](_0x4e2839));if(_0x4e2839[_0xc39c('0x18')]){if(_0x4e2839['error']['code']===0x1f4){logger[_0xc39c('0x18')](_0xc39c('0x13'),_0x5aa8c2,_0x4e2839[_0xc39c('0x18')]['message']);return _0x1b8892(_0x4e2839[_0xc39c('0x18')][_0xc39c('0x19')]);}logger['error'](_0xc39c('0x13'),_0x5aa8c2,_0x4e2839[_0xc39c('0x18')][_0xc39c('0x19')]);return _0x2923be(_0x4e2839[_0xc39c('0x18')][_0xc39c('0x19')]);}else{logger['info'](_0xc39c('0x13'),_0x5aa8c2,'request\x20sent');_0x2923be(_0x4e2839[_0xc39c('0x1a')][_0xc39c('0x19')]);}})[_0xc39c('0x1b')](function(_0x30a7c4){logger[_0xc39c('0x18')](_0xc39c('0x13'),_0x5aa8c2,_0x30a7c4);_0x1b8892(_0x30a7c4);});});}