88987a671f129d32b8a0dcfa2c7ef9f160d60dbc
[motion2.git] / server / api / schedule / schedule.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 _0x2095=['client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise'];(function(_0x4ce7d5,_0x38c0ca){var _0x2750c1=function(_0x579dad){while(--_0x579dad){_0x4ce7d5['push'](_0x4ce7d5['shift']());}};_0x2750c1(++_0x38c0ca);}(_0x2095,0x10a));var _0x5209=function(_0x4e94c0,_0x300e9b){_0x4e94c0=_0x4e94c0-0x0;var _0x216e22=_0x2095[_0x4e94c0];return _0x216e22;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5209('0x0'));var BPromise=require(_0x5209('0x1'));var rs=require(_0x5209('0x2'));var fs=require('fs');var Redis=require(_0x5209('0x3'));var db=require(_0x5209('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5209('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5209('0x6'));var client=jayson[_0x5209('0x7')][_0x5209('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f268f,_0x5ca21f,_0x2a1723){return new BPromise(function(_0x40286d,_0x2a2c92){return client[_0x5209('0x9')](_0x1f268f,_0x2a1723)['then'](function(_0x2273e9){logger[_0x5209('0xa')](_0x5209('0xb'),_0x5ca21f,_0x5209('0xc'));logger[_0x5209('0xd')](_0x5209('0xe'),_0x5ca21f,'request\x20sent',JSON[_0x5209('0xf')](_0x2273e9));if(_0x2273e9[_0x5209('0x10')]){if(_0x2273e9[_0x5209('0x10')][_0x5209('0x11')]===0x1f4){logger[_0x5209('0x10')](_0x5209('0xb'),_0x5ca21f,_0x2273e9[_0x5209('0x10')][_0x5209('0x12')]);return _0x2a2c92(_0x2273e9[_0x5209('0x10')][_0x5209('0x12')]);}logger['error'](_0x5209('0xb'),_0x5ca21f,_0x2273e9[_0x5209('0x10')][_0x5209('0x12')]);return _0x40286d(_0x2273e9[_0x5209('0x10')][_0x5209('0x12')]);}else{logger[_0x5209('0xa')](_0x5209('0xb'),_0x5ca21f,_0x5209('0xc'));_0x40286d(_0x2273e9[_0x5209('0x13')]['message']);}})[_0x5209('0x14')](function(_0x3f633c){logger[_0x5209('0x10')](_0x5209('0xb'),_0x5ca21f,_0x3f633c);_0x2a2c92(_0x3f633c);});});}