Built motion from commit 47436d59.|2.6.7
[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 _0xef01=['code','Team,\x20%s,\x20%s','message','catch','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x53941a,_0x21bd34){var _0x3c5396=function(_0x553212){while(--_0x553212){_0x53941a['push'](_0x53941a['shift']());}};_0x3c5396(++_0x21bd34);}(_0xef01,0x1d8));var _0x1ef0=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xef01[_0x2aec52];return _0x3b8835;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1ef0('0x0'));var fs=require('fs');var Redis=require(_0x1ef0('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ef0('0x2'));var logger=require(_0x1ef0('0x3'))(_0x1ef0('0x4'));var config=require(_0x1ef0('0x5'));var jayson=require(_0x1ef0('0x6'));var client=jayson[_0x1ef0('0x7')][_0x1ef0('0x8')]({'port':0x232a});config[_0x1ef0('0x9')]=_[_0x1ef0('0xa')](config[_0x1ef0('0x9')],{'host':_0x1ef0('0xb'),'port':0x18eb});var socket=require(_0x1ef0('0xc'))(new Redis(config[_0x1ef0('0x9')]));require(_0x1ef0('0xd'))['register'](socket);function respondWithRpcPromise(_0x34ffff,_0x4e73ac,_0x598190){return new BPromise(function(_0x2e105,_0x6cfec0){return client[_0x1ef0('0xe')](_0x34ffff,_0x598190)[_0x1ef0('0xf')](function(_0xe1928f){logger[_0x1ef0('0x10')]('Team,\x20%s,\x20%s',_0x4e73ac,_0x1ef0('0x11'));logger[_0x1ef0('0x12')](_0x1ef0('0x13'),_0x4e73ac,_0x1ef0('0x11'),JSON[_0x1ef0('0x14')](_0xe1928f));if(_0xe1928f[_0x1ef0('0x15')]){if(_0xe1928f[_0x1ef0('0x15')][_0x1ef0('0x16')]===0x1f4){logger[_0x1ef0('0x15')](_0x1ef0('0x17'),_0x4e73ac,_0xe1928f[_0x1ef0('0x15')][_0x1ef0('0x18')]);return _0x6cfec0(_0xe1928f[_0x1ef0('0x15')][_0x1ef0('0x18')]);}logger['error']('Team,\x20%s,\x20%s',_0x4e73ac,_0xe1928f['error']['message']);return _0x2e105(_0xe1928f[_0x1ef0('0x15')][_0x1ef0('0x18')]);}else{logger[_0x1ef0('0x10')](_0x1ef0('0x17'),_0x4e73ac,_0x1ef0('0x11'));_0x2e105(_0xe1928f['result']['message']);}})[_0x1ef0('0x19')](function(_0x289aaf){logger[_0x1ef0('0x15')](_0x1ef0('0x17'),_0x4e73ac,_0x289aaf);_0x6cfec0(_0x289aaf);});});}