81e3252fcd00eedb5e717b078cb8252cd4c7372b
[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 _0xc9c3=['socket.io-emitter','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost'];(function(_0x58dfe4,_0x42f5dd){var _0x2012a8=function(_0x234e52){while(--_0x234e52){_0x58dfe4['push'](_0x58dfe4['shift']());}};_0x2012a8(++_0x42f5dd);}(_0xc9c3,0x96));var _0x3c9c=function(_0x407b6e,_0x3992c5){_0x407b6e=_0x407b6e-0x0;var _0x4d3f84=_0xc9c3[_0x407b6e];return _0x4d3f84;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c9c('0x0'));var BPromise=require('bluebird');var rs=require(_0x3c9c('0x1'));var fs=require('fs');var Redis=require(_0x3c9c('0x2'));var db=require(_0x3c9c('0x3'))['db'];var utils=require(_0x3c9c('0x4'));var logger=require(_0x3c9c('0x5'))(_0x3c9c('0x6'));var config=require(_0x3c9c('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x3c9c('0x8')]=_[_0x3c9c('0x9')](config[_0x3c9c('0x8')],{'host':_0x3c9c('0xa'),'port':0x18eb});var socket=require(_0x3c9c('0xb'))(new Redis(config[_0x3c9c('0x8')]));require(_0x3c9c('0xc'))[_0x3c9c('0xd')](socket);function respondWithRpcPromise(_0x2be851,_0x28a59f,_0x50bdd1){return new BPromise(function(_0x20ed5c,_0xc45f8b){return client['request'](_0x2be851,_0x50bdd1)[_0x3c9c('0xe')](function(_0x4c6969){logger[_0x3c9c('0xf')](_0x3c9c('0x10'),_0x28a59f,_0x3c9c('0x11'));logger[_0x3c9c('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x28a59f,'request\x20sent',JSON['stringify'](_0x4c6969));if(_0x4c6969[_0x3c9c('0x13')]){if(_0x4c6969['error']['code']===0x1f4){logger['error'](_0x3c9c('0x10'),_0x28a59f,_0x4c6969['error'][_0x3c9c('0x14')]);return _0xc45f8b(_0x4c6969[_0x3c9c('0x13')][_0x3c9c('0x14')]);}logger[_0x3c9c('0x13')]('UserProfile,\x20%s,\x20%s',_0x28a59f,_0x4c6969[_0x3c9c('0x13')]['message']);return _0x20ed5c(_0x4c6969['error']['message']);}else{logger[_0x3c9c('0xf')](_0x3c9c('0x10'),_0x28a59f,_0x3c9c('0x11'));_0x20ed5c(_0x4c6969[_0x3c9c('0x15')][_0x3c9c('0x14')]);}})[_0x3c9c('0x16')](function(_0x319f19){logger['error'](_0x3c9c('0x10'),_0x28a59f,_0x319f19);_0xc45f8b(_0x319f19);});});}