018095d3679d62d9edaeda508d4b8b8290318ba7
[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 _0xa321=['request\x20sent','stringify','error','code','message','Schedule,\x20%s,\x20%s','result','moment','bluebird','ioredis','rpc','request','then','info','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0xa321,0xa7));var _0x1a32=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0xa321[_0x39d39d];return _0x577ac3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a32('0x0'));var BPromise=require(_0x1a32('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a32('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a32('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b4001,_0x43547f,_0x44e8cd){return new BPromise(function(_0x342753,_0x4383ef){return client[_0x1a32('0x4')](_0x2b4001,_0x44e8cd)[_0x1a32('0x5')](function(_0xfb4037){logger[_0x1a32('0x6')]('Schedule,\x20%s,\x20%s',_0x43547f,'request\x20sent');logger[_0x1a32('0x7')](_0x1a32('0x8'),_0x43547f,_0x1a32('0x9'),JSON[_0x1a32('0xa')](_0xfb4037));if(_0xfb4037[_0x1a32('0xb')]){if(_0xfb4037[_0x1a32('0xb')][_0x1a32('0xc')]===0x1f4){logger[_0x1a32('0xb')]('Schedule,\x20%s,\x20%s',_0x43547f,_0xfb4037[_0x1a32('0xb')][_0x1a32('0xd')]);return _0x4383ef(_0xfb4037[_0x1a32('0xb')][_0x1a32('0xd')]);}logger[_0x1a32('0xb')](_0x1a32('0xe'),_0x43547f,_0xfb4037[_0x1a32('0xb')]['message']);return _0x342753(_0xfb4037[_0x1a32('0xb')][_0x1a32('0xd')]);}else{logger[_0x1a32('0x6')]('Schedule,\x20%s,\x20%s',_0x43547f,'request\x20sent');_0x342753(_0xfb4037[_0x1a32('0xf')][_0x1a32('0xd')]);}})['catch'](function(_0x52373d){logger[_0x1a32('0xb')](_0x1a32('0xe'),_0x43547f,_0x52373d);_0x4383ef(_0x52373d);});});}