debeb8c8675541b40f75de4e21699a6ae8d40829
[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 _0xb9fb=['Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xb9fb,0x1b5));var _0xbb9f=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xb9fb[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xbb9f('0x0'));var util=require('util');var moment=require(_0xbb9f('0x1'));var BPromise=require(_0xbb9f('0x2'));var rs=require(_0xbb9f('0x3'));var fs=require('fs');var Redis=require(_0xbb9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb9f('0x5'));var logger=require(_0xbb9f('0x6'))(_0xbb9f('0x7'));var config=require(_0xbb9f('0x8'));var jayson=require(_0xbb9f('0x9'));var client=jayson[_0xbb9f('0xa')]['http']({'port':0x232a});config[_0xbb9f('0xb')]=_[_0xbb9f('0xc')](config[_0xbb9f('0xb')],{'host':_0xbb9f('0xd'),'port':0x18eb});var socket=require(_0xbb9f('0xe'))(new Redis(config[_0xbb9f('0xb')]));require(_0xbb9f('0xf'))['register'](socket);function respondWithRpcPromise(_0x22eaec,_0x31b412,_0x56f44a){return new BPromise(function(_0x58a46f,_0x586ce1){return client[_0xbb9f('0x10')](_0x22eaec,_0x56f44a)[_0xbb9f('0x11')](function(_0xae1f6f){logger[_0xbb9f('0x12')](_0xbb9f('0x13'),_0x31b412,_0xbb9f('0x14'));logger[_0xbb9f('0x15')](_0xbb9f('0x16'),_0x31b412,_0xbb9f('0x14'),JSON[_0xbb9f('0x17')](_0xae1f6f));if(_0xae1f6f['error']){if(_0xae1f6f[_0xbb9f('0x18')]['code']===0x1f4){logger[_0xbb9f('0x18')](_0xbb9f('0x13'),_0x31b412,_0xae1f6f[_0xbb9f('0x18')]['message']);return _0x586ce1(_0xae1f6f['error'][_0xbb9f('0x19')]);}logger['error'](_0xbb9f('0x13'),_0x31b412,_0xae1f6f[_0xbb9f('0x18')][_0xbb9f('0x19')]);return _0x58a46f(_0xae1f6f[_0xbb9f('0x18')][_0xbb9f('0x19')]);}else{logger[_0xbb9f('0x12')](_0xbb9f('0x13'),_0x31b412,_0xbb9f('0x14'));_0x58a46f(_0xae1f6f[_0xbb9f('0x1a')][_0xbb9f('0x19')]);}})['catch'](function(_0x4389bb){logger[_0xbb9f('0x18')](_0xbb9f('0x13'),_0x31b412,_0x4389bb);_0x586ce1(_0x4389bb);});});}