b884fbaed42a1f1e9c8e0b48383ee19aced29bec
[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 _0xd14b=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','bluebird'];(function(_0x5d4bcd,_0x12a9bb){var _0xf9e6d9=function(_0x292eaf){while(--_0x292eaf){_0x5d4bcd['push'](_0x5d4bcd['shift']());}};_0xf9e6d9(++_0x12a9bb);}(_0xd14b,0xee));var _0xbd14=function(_0x356c85,_0x22b9c7){_0x356c85=_0x356c85-0x0;var _0x4d6fa1=_0xd14b[_0x356c85];return _0x4d6fa1;};'use strict';var _=require('lodash');var util=require(_0xbd14('0x0'));var moment=require('moment');var BPromise=require(_0xbd14('0x1'));var rs=require(_0xbd14('0x2'));var fs=require('fs');var Redis=require(_0xbd14('0x3'));var db=require(_0xbd14('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd14('0x5'))(_0xbd14('0x6'));var config=require(_0xbd14('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbd14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54aef2,_0x42a42a,_0x21dd94){return new BPromise(function(_0xad2665,_0x8fc2f2){return client['request'](_0x54aef2,_0x21dd94)[_0xbd14('0x9')](function(_0x532eb0){logger[_0xbd14('0xa')](_0xbd14('0xb'),_0x42a42a,'request\x20sent');logger[_0xbd14('0xc')](_0xbd14('0xd'),_0x42a42a,_0xbd14('0xe'),JSON[_0xbd14('0xf')](_0x532eb0));if(_0x532eb0[_0xbd14('0x10')]){if(_0x532eb0[_0xbd14('0x10')][_0xbd14('0x11')]===0x1f4){logger[_0xbd14('0x10')](_0xbd14('0xb'),_0x42a42a,_0x532eb0['error'][_0xbd14('0x12')]);return _0x8fc2f2(_0x532eb0[_0xbd14('0x10')]['message']);}logger[_0xbd14('0x10')](_0xbd14('0xb'),_0x42a42a,_0x532eb0[_0xbd14('0x10')]['message']);return _0xad2665(_0x532eb0[_0xbd14('0x10')][_0xbd14('0x12')]);}else{logger[_0xbd14('0xa')](_0xbd14('0xb'),_0x42a42a,'request\x20sent');_0xad2665(_0x532eb0['result'][_0xbd14('0x12')]);}})[_0xbd14('0x13')](function(_0x26974d){logger[_0xbd14('0x10')]('Schedule,\x20%s,\x20%s',_0x42a42a,_0x26974d);_0x8fc2f2(_0x26974d);});});}