f498f8f7b2975b5b1078966c84eab65f01f8e862
[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 _0x887d=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./team.socket','request','info','Team,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x28e27c,_0x2216ff){var _0x45ae93=function(_0x15f539){while(--_0x15f539){_0x28e27c['push'](_0x28e27c['shift']());}};_0x45ae93(++_0x2216ff);}(_0x887d,0x19d));var _0xd887=function(_0x31b1f9,_0x3bfd04){_0x31b1f9=_0x31b1f9-0x0;var _0x40ecc2=_0x887d[_0x31b1f9];return _0x40ecc2;};'use strict';var _=require(_0xd887('0x0'));var util=require(_0xd887('0x1'));var moment=require(_0xd887('0x2'));var BPromise=require(_0xd887('0x3'));var rs=require(_0xd887('0x4'));var fs=require('fs');var Redis=require(_0xd887('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd887('0x6'));var logger=require('../../config/logger')(_0xd887('0x7'));var config=require('../../config/environment');var jayson=require(_0xd887('0x8'));var client=jayson[_0xd887('0x9')]['http']({'port':0x232a});config[_0xd887('0xa')]=_['defaults'](config[_0xd887('0xa')],{'host':_0xd887('0xb'),'port':0x18eb});var socket=require(_0xd887('0xc'))(new Redis(config[_0xd887('0xa')]));require(_0xd887('0xd'))['register'](socket);function respondWithRpcPromise(_0x104343,_0x542a3c,_0x2753b6){return new BPromise(function(_0x576218,_0x14c050){return client[_0xd887('0xe')](_0x104343,_0x2753b6)['then'](function(_0x27f95a){logger[_0xd887('0xf')](_0xd887('0x10'),_0x542a3c,_0xd887('0x11'));logger[_0xd887('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x542a3c,_0xd887('0x11'),JSON[_0xd887('0x13')](_0x27f95a));if(_0x27f95a[_0xd887('0x14')]){if(_0x27f95a[_0xd887('0x14')][_0xd887('0x15')]===0x1f4){logger[_0xd887('0x14')](_0xd887('0x10'),_0x542a3c,_0x27f95a[_0xd887('0x14')][_0xd887('0x16')]);return _0x14c050(_0x27f95a[_0xd887('0x14')][_0xd887('0x16')]);}logger[_0xd887('0x14')]('Team,\x20%s,\x20%s',_0x542a3c,_0x27f95a[_0xd887('0x14')]['message']);return _0x576218(_0x27f95a[_0xd887('0x14')][_0xd887('0x16')]);}else{logger['info'](_0xd887('0x10'),_0x542a3c,_0xd887('0x11'));_0x576218(_0x27f95a[_0xd887('0x17')][_0xd887('0x16')]);}})['catch'](function(_0x44ab52){logger[_0xd887('0x14')](_0xd887('0x10'),_0x542a3c,_0x44ab52);_0x14c050(_0x44ab52);});});}