Built motion from commit b5996064.|2.6.21
[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 _0xdbf5=['moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x13af8c,_0x249987){var _0x45ed34=function(_0x20e434){while(--_0x20e434){_0x13af8c['push'](_0x13af8c['shift']());}};_0x45ed34(++_0x249987);}(_0xdbf5,0xf1));var _0x5dbf=function(_0x3846d9,_0x191e45){_0x3846d9=_0x3846d9-0x0;var _0x54d986=_0xdbf5[_0x3846d9];return _0x54d986;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rs=require(_0x5dbf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5dbf('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5dbf('0x7')][_0x5dbf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f6c30,_0x2c49d6,_0x3dbe7c){return new BPromise(function(_0x154094,_0x13ef3b){return client[_0x5dbf('0x9')](_0x4f6c30,_0x3dbe7c)[_0x5dbf('0xa')](function(_0x1623b9){logger[_0x5dbf('0xb')](_0x5dbf('0xc'),_0x2c49d6,_0x5dbf('0xd'));logger[_0x5dbf('0xe')](_0x5dbf('0xf'),_0x2c49d6,_0x5dbf('0xd'),JSON[_0x5dbf('0x10')](_0x1623b9));if(_0x1623b9[_0x5dbf('0x11')]){if(_0x1623b9['error'][_0x5dbf('0x12')]===0x1f4){logger[_0x5dbf('0x11')](_0x5dbf('0xc'),_0x2c49d6,_0x1623b9['error'][_0x5dbf('0x13')]);return _0x13ef3b(_0x1623b9[_0x5dbf('0x11')][_0x5dbf('0x13')]);}logger[_0x5dbf('0x11')](_0x5dbf('0xc'),_0x2c49d6,_0x1623b9['error']['message']);return _0x154094(_0x1623b9[_0x5dbf('0x11')][_0x5dbf('0x13')]);}else{logger['info'](_0x5dbf('0xc'),_0x2c49d6,'request\x20sent');_0x154094(_0x1623b9[_0x5dbf('0x14')][_0x5dbf('0x13')]);}})[_0x5dbf('0x15')](function(_0xc7c5ff){logger[_0x5dbf('0x11')](_0x5dbf('0xc'),_0x2c49d6,_0xc7c5ff);_0x13ef3b(_0xc7c5ff);});});}