Built motion from commit da617fac.|2.6.6
[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 _0xbbc6=['then','info','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','Team,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','request'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xbbc6,0x90));var _0x6bbc=function(_0x829275,_0x161f1f){_0x829275=_0x829275-0x0;var _0x38f78a=_0xbbc6[_0x829275];return _0x38f78a;};'use strict';var _=require(_0x6bbc('0x0'));var util=require(_0x6bbc('0x1'));var moment=require(_0x6bbc('0x2'));var BPromise=require(_0x6bbc('0x3'));var rs=require(_0x6bbc('0x4'));var fs=require('fs');var Redis=require(_0x6bbc('0x5'));var db=require(_0x6bbc('0x6'))['db'];var utils=require(_0x6bbc('0x7'));var logger=require(_0x6bbc('0x8'))(_0x6bbc('0x9'));var config=require(_0x6bbc('0xa'));var jayson=require(_0x6bbc('0xb'));var client=jayson[_0x6bbc('0xc')]['http']({'port':0x232a});config['redis']=_[_0x6bbc('0xd')](config['redis'],{'host':_0x6bbc('0xe'),'port':0x18eb});var socket=require(_0x6bbc('0xf'))(new Redis(config[_0x6bbc('0x10')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x576091,_0x2862e4,_0x5d0985){return new BPromise(function(_0x193367,_0x4fe50e){return client[_0x6bbc('0x11')](_0x576091,_0x5d0985)[_0x6bbc('0x12')](function(_0x33e36d){logger[_0x6bbc('0x13')]('Team,\x20%s,\x20%s',_0x2862e4,_0x6bbc('0x14'));logger['debug'](_0x6bbc('0x15'),_0x2862e4,'request\x20sent',JSON[_0x6bbc('0x16')](_0x33e36d));if(_0x33e36d[_0x6bbc('0x17')]){if(_0x33e36d[_0x6bbc('0x17')]['code']===0x1f4){logger[_0x6bbc('0x17')]('Team,\x20%s,\x20%s',_0x2862e4,_0x33e36d[_0x6bbc('0x17')]['message']);return _0x4fe50e(_0x33e36d[_0x6bbc('0x17')][_0x6bbc('0x18')]);}logger[_0x6bbc('0x17')](_0x6bbc('0x19'),_0x2862e4,_0x33e36d[_0x6bbc('0x17')][_0x6bbc('0x18')]);return _0x193367(_0x33e36d[_0x6bbc('0x17')][_0x6bbc('0x18')]);}else{logger['info'](_0x6bbc('0x19'),_0x2862e4,'request\x20sent');_0x193367(_0x33e36d[_0x6bbc('0x1a')][_0x6bbc('0x18')]);}})['catch'](function(_0x448af0){logger[_0x6bbc('0x17')](_0x6bbc('0x19'),_0x2862e4,_0x448af0);_0x4fe50e(_0x448af0);});});}