ea74bdd2908096a6f455b61a9f4d34b469c9e37b
[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 _0x3d06=['debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','Schedule,\x20%s,\x20%s'];(function(_0x231d36,_0x5bdd2b){var _0x41357b=function(_0xff89d1){while(--_0xff89d1){_0x231d36['push'](_0x231d36['shift']());}};_0x41357b(++_0x5bdd2b);}(_0x3d06,0x71));var _0x63d0=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x3d06[_0x19b84f];return _0x18067b;};'use strict';var _=require(_0x63d0('0x0'));var util=require(_0x63d0('0x1'));var moment=require(_0x63d0('0x2'));var BPromise=require(_0x63d0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63d0('0x4'));var db=require(_0x63d0('0x5'))['db'];var utils=require(_0x63d0('0x6'));var logger=require(_0x63d0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x63d0('0x8'));var client=jayson['client'][_0x63d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x558bd7,_0x158537,_0x4b3efa){return new BPromise(function(_0x5b2bdc,_0x58916a){return client[_0x63d0('0xa')](_0x558bd7,_0x4b3efa)['then'](function(_0x5b1691){logger[_0x63d0('0xb')](_0x63d0('0xc'),_0x158537,'request\x20sent');logger[_0x63d0('0xd')](_0x63d0('0xe'),_0x158537,'request\x20sent',JSON[_0x63d0('0xf')](_0x5b1691));if(_0x5b1691[_0x63d0('0x10')]){if(_0x5b1691['error'][_0x63d0('0x11')]===0x1f4){logger[_0x63d0('0x10')]('Schedule,\x20%s,\x20%s',_0x158537,_0x5b1691[_0x63d0('0x10')][_0x63d0('0x12')]);return _0x58916a(_0x5b1691[_0x63d0('0x10')][_0x63d0('0x12')]);}logger[_0x63d0('0x10')](_0x63d0('0xc'),_0x158537,_0x5b1691['error'][_0x63d0('0x12')]);return _0x5b2bdc(_0x5b1691[_0x63d0('0x10')][_0x63d0('0x12')]);}else{logger[_0x63d0('0xb')]('Schedule,\x20%s,\x20%s',_0x158537,_0x63d0('0x13'));_0x5b2bdc(_0x5b1691[_0x63d0('0x14')][_0x63d0('0x12')]);}})['catch'](function(_0x7443d1){logger[_0x63d0('0x10')](_0x63d0('0xc'),_0x158537,_0x7443d1);_0x58916a(_0x7443d1);});});}