b392394684e1a1ac5b99df3cc6a2ded8dce67da6
[motion2.git] / server / api / userProfileResource / userProfileResource.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 _0x1ffa=['message','info','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4c6868,_0x5c2960){var _0x4b77d2=function(_0x4192bf){while(--_0x4192bf){_0x4c6868['push'](_0x4c6868['shift']());}};_0x4b77d2(++_0x5c2960);}(_0x1ffa,0x16a));var _0xa1ff=function(_0x9c6c1c,_0x21ead9){_0x9c6c1c=_0x9c6c1c-0x0;var _0x594c42=_0x1ffa[_0x9c6c1c];return _0x594c42;};'use strict';var _=require('lodash');var util=require(_0xa1ff('0x0'));var moment=require(_0xa1ff('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa1ff('0x2'));var db=require(_0xa1ff('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1ff('0x4'))(_0xa1ff('0x5'));var config=require(_0xa1ff('0x6'));var jayson=require(_0xa1ff('0x7'));var client=jayson[_0xa1ff('0x8')][_0xa1ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42f72b,_0x4af077,_0x3dd3cc){return new BPromise(function(_0x5f3cea,_0x1ba2e3){return client['request'](_0x42f72b,_0x3dd3cc)[_0xa1ff('0xa')](function(_0x1d41f3){logger['info'](_0xa1ff('0xb'),_0x4af077,_0xa1ff('0xc'));logger['debug'](_0xa1ff('0xd'),_0x4af077,_0xa1ff('0xc'),JSON[_0xa1ff('0xe')](_0x1d41f3));if(_0x1d41f3[_0xa1ff('0xf')]){if(_0x1d41f3['error']['code']===0x1f4){logger[_0xa1ff('0xf')](_0xa1ff('0xb'),_0x4af077,_0x1d41f3[_0xa1ff('0xf')][_0xa1ff('0x10')]);return _0x1ba2e3(_0x1d41f3[_0xa1ff('0xf')][_0xa1ff('0x10')]);}logger[_0xa1ff('0xf')](_0xa1ff('0xb'),_0x4af077,_0x1d41f3['error'][_0xa1ff('0x10')]);return _0x5f3cea(_0x1d41f3[_0xa1ff('0xf')]['message']);}else{logger[_0xa1ff('0x11')](_0xa1ff('0xb'),_0x4af077,_0xa1ff('0xc'));_0x5f3cea(_0x1d41f3['result']['message']);}})['catch'](function(_0x1981c5){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x4af077,_0x1981c5);_0x1ba2e3(_0x1981c5);});});}