ee108845fff61ebea546d1cdc1aee51eb3f147a5
[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 _0xe517=['rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4fd6fb,_0x5854c7){var _0x21c0c6=function(_0x318d0b){while(--_0x318d0b){_0x4fd6fb['push'](_0x4fd6fb['shift']());}};_0x21c0c6(++_0x5854c7);}(_0xe517,0x7d));var _0x7e51=function(_0x1b69b6,_0x9eb4ee){_0x1b69b6=_0x1b69b6-0x0;var _0x4aaf36=_0xe517[_0x1b69b6];return _0x4aaf36;};'use strict';var _=require(_0x7e51('0x0'));var util=require(_0x7e51('0x1'));var moment=require(_0x7e51('0x2'));var BPromise=require(_0x7e51('0x3'));var rs=require(_0x7e51('0x4'));var fs=require('fs');var Redis=require(_0x7e51('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e51('0x6'));var logger=require('../../config/logger')(_0x7e51('0x7'));var config=require('../../config/environment');var jayson=require(_0x7e51('0x8'));var client=jayson[_0x7e51('0x9')][_0x7e51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5732a2,_0x40a8d8,_0x154581){return new BPromise(function(_0x324126,_0x575d02){return client[_0x7e51('0xb')](_0x5732a2,_0x154581)[_0x7e51('0xc')](function(_0x3fafff){logger[_0x7e51('0xd')](_0x7e51('0xe'),_0x40a8d8,_0x7e51('0xf'));logger[_0x7e51('0x10')](_0x7e51('0x11'),_0x40a8d8,'request\x20sent',JSON[_0x7e51('0x12')](_0x3fafff));if(_0x3fafff[_0x7e51('0x13')]){if(_0x3fafff[_0x7e51('0x13')][_0x7e51('0x14')]===0x1f4){logger['error'](_0x7e51('0xe'),_0x40a8d8,_0x3fafff[_0x7e51('0x13')][_0x7e51('0x15')]);return _0x575d02(_0x3fafff[_0x7e51('0x13')][_0x7e51('0x15')]);}logger['error'](_0x7e51('0xe'),_0x40a8d8,_0x3fafff[_0x7e51('0x13')][_0x7e51('0x15')]);return _0x324126(_0x3fafff[_0x7e51('0x13')][_0x7e51('0x15')]);}else{logger['info'](_0x7e51('0xe'),_0x40a8d8,_0x7e51('0xf'));_0x324126(_0x3fafff['result'][_0x7e51('0x15')]);}})['catch'](function(_0x23f0ea){logger[_0x7e51('0x13')](_0x7e51('0xe'),_0x40a8d8,_0x23f0ea);_0x575d02(_0x23f0ea);});});}