Built motion from commit (unavailable).|2.2.0
[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 _0x234d=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./team.socket','register','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','Team,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis'];(function(_0x45f833,_0x175e3f){var _0x1cf041=function(_0x48acc7){while(--_0x48acc7){_0x45f833['push'](_0x45f833['shift']());}};_0x1cf041(++_0x175e3f);}(_0x234d,0xbb));var _0xd234=function(_0x9fa924,_0x110743){_0x9fa924=_0x9fa924-0x0;var _0x435105=_0x234d[_0x9fa924];return _0x435105;};'use strict';var _=require('lodash');var util=require(_0xd234('0x0'));var moment=require(_0xd234('0x1'));var BPromise=require(_0xd234('0x2'));var rs=require(_0xd234('0x3'));var fs=require('fs');var Redis=require(_0xd234('0x4'));var db=require(_0xd234('0x5'))['db'];var utils=require(_0xd234('0x6'));var logger=require(_0xd234('0x7'))('rpc');var config=require(_0xd234('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd234('0x9')][_0xd234('0xa')]({'port':0x232a});config[_0xd234('0xb')]=_[_0xd234('0xc')](config[_0xd234('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd234('0xd'))(new Redis(config[_0xd234('0xb')]));require(_0xd234('0xe'))[_0xd234('0xf')](socket);function respondWithRpcPromise(_0x16f3ad,_0x954981,_0x1f7658){return new BPromise(function(_0x3e6919,_0x6eaed2){return client['request'](_0x16f3ad,_0x1f7658)['then'](function(_0x1b26f6){logger[_0xd234('0x10')]('Team,\x20%s,\x20%s',_0x954981,_0xd234('0x11'));logger[_0xd234('0x12')](_0xd234('0x13'),_0x954981,_0xd234('0x11'),JSON[_0xd234('0x14')](_0x1b26f6));if(_0x1b26f6[_0xd234('0x15')]){if(_0x1b26f6['error']['code']===0x1f4){logger[_0xd234('0x15')](_0xd234('0x16'),_0x954981,_0x1b26f6[_0xd234('0x15')]['message']);return _0x6eaed2(_0x1b26f6[_0xd234('0x15')][_0xd234('0x17')]);}logger[_0xd234('0x15')](_0xd234('0x16'),_0x954981,_0x1b26f6['error']['message']);return _0x3e6919(_0x1b26f6[_0xd234('0x15')]['message']);}else{logger[_0xd234('0x10')](_0xd234('0x16'),_0x954981,_0xd234('0x11'));_0x3e6919(_0x1b26f6['result'][_0xd234('0x17')]);}})['catch'](function(_0x518c8c){logger[_0xd234('0x15')]('Team,\x20%s,\x20%s',_0x954981,_0x518c8c);_0x6eaed2(_0x518c8c);});});}