Built motion from commit (unavailable).|2.4.20
[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 _0x32a7=['Team,\x20%s,\x20%s','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','register','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x50b967,_0x3656bf){var _0x1af412=function(_0x280029){while(--_0x280029){_0x50b967['push'](_0x50b967['shift']());}};_0x1af412(++_0x3656bf);}(_0x32a7,0x9c));var _0x732a=function(_0x423ab9,_0x4917da){_0x423ab9=_0x423ab9-0x0;var _0x4a1bc3=_0x32a7[_0x423ab9];return _0x4a1bc3;};'use strict';var _=require(_0x732a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x732a('0x1'));var rs=require(_0x732a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x732a('0x3'))['db'];var utils=require(_0x732a('0x4'));var logger=require('../../config/logger')(_0x732a('0x5'));var config=require(_0x732a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x732a('0x7')]['http']({'port':0x232a});config[_0x732a('0x8')]=_[_0x732a('0x9')](config[_0x732a('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x732a('0x8')]));require('./team.socket')[_0x732a('0xa')](socket);function respondWithRpcPromise(_0x58e548,_0x209e95,_0x5e6c0c){return new BPromise(function(_0x3b9200,_0xfdd9cb){return client[_0x732a('0xb')](_0x58e548,_0x5e6c0c)[_0x732a('0xc')](function(_0x2dcfd5){logger[_0x732a('0xd')]('Team,\x20%s,\x20%s',_0x209e95,_0x732a('0xe'));logger[_0x732a('0xf')]('Team,\x20%s,\x20%s,\x20%s',_0x209e95,_0x732a('0xe'),JSON[_0x732a('0x10')](_0x2dcfd5));if(_0x2dcfd5[_0x732a('0x11')]){if(_0x2dcfd5['error'][_0x732a('0x12')]===0x1f4){logger[_0x732a('0x11')]('Team,\x20%s,\x20%s',_0x209e95,_0x2dcfd5['error'][_0x732a('0x13')]);return _0xfdd9cb(_0x2dcfd5[_0x732a('0x11')]['message']);}logger[_0x732a('0x11')]('Team,\x20%s,\x20%s',_0x209e95,_0x2dcfd5[_0x732a('0x11')][_0x732a('0x13')]);return _0x3b9200(_0x2dcfd5[_0x732a('0x11')][_0x732a('0x13')]);}else{logger['info'](_0x732a('0x14'),_0x209e95,'request\x20sent');_0x3b9200(_0x2dcfd5['result'][_0x732a('0x13')]);}})[_0x732a('0x15')](function(_0x1ad4a5){logger['error']('Team,\x20%s,\x20%s',_0x209e95,_0x1ad4a5);_0xfdd9cb(_0x1ad4a5);});});}