Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / userProfile / userProfile.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 _0x27eb=['localhost','./userProfile.socket','register','UserProfile,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x2fdf82,_0x322e7c){var _0x2382f5=function(_0x4d6951){while(--_0x4d6951){_0x2fdf82['push'](_0x2fdf82['shift']());}};_0x2382f5(++_0x322e7c);}(_0x27eb,0xd0));var _0xb27e=function(_0x5edac4,_0x4957f7){_0x5edac4=_0x5edac4-0x0;var _0x4f31de=_0x27eb[_0x5edac4];return _0x4f31de;};'use strict';var _=require(_0xb27e('0x0'));var util=require(_0xb27e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb27e('0x2'));var fs=require('fs');var Redis=require(_0xb27e('0x3'));var db=require(_0xb27e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb27e('0x5'))(_0xb27e('0x6'));var config=require(_0xb27e('0x7'));var jayson=require(_0xb27e('0x8'));var client=jayson['client'][_0xb27e('0x9')]({'port':0x232a});config[_0xb27e('0xa')]=_[_0xb27e('0xb')](config[_0xb27e('0xa')],{'host':_0xb27e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb27e('0xa')]));require(_0xb27e('0xd'))[_0xb27e('0xe')](socket);function respondWithRpcPromise(_0x2e9752,_0x26ea1f,_0x51a872){return new BPromise(function(_0x2b7bdc,_0x11bd85){return client['request'](_0x2e9752,_0x51a872)['then'](function(_0x38a41d){logger['info'](_0xb27e('0xf'),_0x26ea1f,_0xb27e('0x10'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x26ea1f,'request\x20sent',JSON[_0xb27e('0x11')](_0x38a41d));if(_0x38a41d['error']){if(_0x38a41d[_0xb27e('0x12')]['code']===0x1f4){logger[_0xb27e('0x12')]('UserProfile,\x20%s,\x20%s',_0x26ea1f,_0x38a41d[_0xb27e('0x12')][_0xb27e('0x13')]);return _0x11bd85(_0x38a41d[_0xb27e('0x12')]['message']);}logger[_0xb27e('0x12')](_0xb27e('0xf'),_0x26ea1f,_0x38a41d[_0xb27e('0x12')][_0xb27e('0x13')]);return _0x2b7bdc(_0x38a41d[_0xb27e('0x12')][_0xb27e('0x13')]);}else{logger[_0xb27e('0x14')](_0xb27e('0xf'),_0x26ea1f,_0xb27e('0x10'));_0x2b7bdc(_0x38a41d['result'][_0xb27e('0x13')]);}})[_0xb27e('0x15')](function(_0x26bbf9){logger['error'](_0xb27e('0xf'),_0x26ea1f,_0x26bbf9);_0x11bd85(_0x26bbf9);});});}