Built motion from commit (unavailable).|2.5.4
[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 _0x4747=['Team,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info'];(function(_0x49695f,_0x4d717c){var _0x5c0c98=function(_0x1977ae){while(--_0x1977ae){_0x49695f['push'](_0x49695f['shift']());}};_0x5c0c98(++_0x4d717c);}(_0x4747,0x182));var _0x7474=function(_0xa92ea7,_0x47d6c2){_0xa92ea7=_0xa92ea7-0x0;var _0x2441ff=_0x4747[_0xa92ea7];return _0x2441ff;};'use strict';var _=require('lodash');var util=require(_0x7474('0x0'));var moment=require(_0x7474('0x1'));var BPromise=require(_0x7474('0x2'));var rs=require(_0x7474('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7474('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7474('0x5'))(_0x7474('0x6'));var config=require(_0x7474('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7474('0x8')][_0x7474('0x9')]({'port':0x232a});config[_0x7474('0xa')]=_[_0x7474('0xb')](config[_0x7474('0xa')],{'host':_0x7474('0xc'),'port':0x18eb});var socket=require(_0x7474('0xd'))(new Redis(config[_0x7474('0xa')]));require(_0x7474('0xe'))[_0x7474('0xf')](socket);function respondWithRpcPromise(_0xeb44e9,_0xf5f465,_0x9e5fa){return new BPromise(function(_0x555c98,_0x17f832){return client[_0x7474('0x10')](_0xeb44e9,_0x9e5fa)[_0x7474('0x11')](function(_0x6705c){logger[_0x7474('0x12')](_0x7474('0x13'),_0xf5f465,_0x7474('0x14'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0xf5f465,'request\x20sent',JSON[_0x7474('0x15')](_0x6705c));if(_0x6705c[_0x7474('0x16')]){if(_0x6705c['error'][_0x7474('0x17')]===0x1f4){logger[_0x7474('0x16')](_0x7474('0x13'),_0xf5f465,_0x6705c[_0x7474('0x16')][_0x7474('0x18')]);return _0x17f832(_0x6705c['error']['message']);}logger[_0x7474('0x16')](_0x7474('0x13'),_0xf5f465,_0x6705c[_0x7474('0x16')][_0x7474('0x18')]);return _0x555c98(_0x6705c[_0x7474('0x16')][_0x7474('0x18')]);}else{logger['info'](_0x7474('0x13'),_0xf5f465,_0x7474('0x14'));_0x555c98(_0x6705c[_0x7474('0x19')][_0x7474('0x18')]);}})[_0x7474('0x1a')](function(_0x165981){logger[_0x7474('0x16')]('Team,\x20%s,\x20%s',_0xf5f465,_0x165981);_0x17f832(_0x165981);});});}