e32eb977a842cad0657f9899332b67da5b9527bb
[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 _0x0b3d=['UserProfile,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','defaults','socket.io-emitter','register','request','then','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x13ae9c,_0x34982a){var _0x45303a=function(_0x1b4604){while(--_0x1b4604){_0x13ae9c['push'](_0x13ae9c['shift']());}};_0x45303a(++_0x34982a);}(_0x0b3d,0x76));var _0xd0b3=function(_0x3566d0,_0x34a49f){_0x3566d0=_0x3566d0-0x0;var _0x3fd4da=_0x0b3d[_0x3566d0];return _0x3fd4da;};'use strict';var _=require(_0xd0b3('0x0'));var util=require('util');var moment=require(_0xd0b3('0x1'));var BPromise=require('bluebird');var rs=require(_0xd0b3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0b3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0b3('0x4'))('rpc');var config=require(_0xd0b3('0x5'));var jayson=require(_0xd0b3('0x6'));var client=jayson['client'][_0xd0b3('0x7')]({'port':0x232a});config['redis']=_[_0xd0b3('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd0b3('0x9'))(new Redis(config['redis']));require('./userProfile.socket')[_0xd0b3('0xa')](socket);function respondWithRpcPromise(_0x50261b,_0x176d4e,_0x336b7f){return new BPromise(function(_0x5950d7,_0x4dfc6f){return client[_0xd0b3('0xb')](_0x50261b,_0x336b7f)[_0xd0b3('0xc')](function(_0x28c793){logger[_0xd0b3('0xd')]('UserProfile,\x20%s,\x20%s',_0x176d4e,'request\x20sent');logger[_0xd0b3('0xe')](_0xd0b3('0xf'),_0x176d4e,_0xd0b3('0x10'),JSON[_0xd0b3('0x11')](_0x28c793));if(_0x28c793[_0xd0b3('0x12')]){if(_0x28c793[_0xd0b3('0x12')][_0xd0b3('0x13')]===0x1f4){logger['error'](_0xd0b3('0x14'),_0x176d4e,_0x28c793[_0xd0b3('0x12')][_0xd0b3('0x15')]);return _0x4dfc6f(_0x28c793[_0xd0b3('0x12')]['message']);}logger[_0xd0b3('0x12')](_0xd0b3('0x14'),_0x176d4e,_0x28c793[_0xd0b3('0x12')]['message']);return _0x5950d7(_0x28c793[_0xd0b3('0x12')][_0xd0b3('0x15')]);}else{logger['info'](_0xd0b3('0x14'),_0x176d4e,_0xd0b3('0x10'));_0x5950d7(_0x28c793['result'][_0xd0b3('0x15')]);}})[_0xd0b3('0x16')](function(_0x3a37a6){logger['error'](_0xd0b3('0x14'),_0x176d4e,_0x3a37a6);_0x4dfc6f(_0x3a37a6);});});}