645d405d5f5bce4f5f1c96fc9bd00a5b1b8159a6
[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 _0x6e0f=['http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4677e8,_0x2b383a){var _0x50af05=function(_0x2301c5){while(--_0x2301c5){_0x4677e8['push'](_0x4677e8['shift']());}};_0x50af05(++_0x2b383a);}(_0x6e0f,0x9d));var _0xf6e0=function(_0x3409c5,_0x39a750){_0x3409c5=_0x3409c5-0x0;var _0x3e0455=_0x6e0f[_0x3409c5];return _0x3e0455;};'use strict';var _=require('lodash');var util=require(_0xf6e0('0x0'));var moment=require(_0xf6e0('0x1'));var BPromise=require(_0xf6e0('0x2'));var rs=require(_0xf6e0('0x3'));var fs=require('fs');var Redis=require(_0xf6e0('0x4'));var db=require(_0xf6e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6e0('0x6'))(_0xf6e0('0x7'));var config=require(_0xf6e0('0x8'));var jayson=require(_0xf6e0('0x9'));var client=jayson[_0xf6e0('0xa')][_0xf6e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf59b46,_0x47d5c7,_0x5e703){return new BPromise(function(_0x2926dd,_0x2f72c1){return client[_0xf6e0('0xc')](_0xf59b46,_0x5e703)['then'](function(_0x4adbf8){logger[_0xf6e0('0xd')](_0xf6e0('0xe'),_0x47d5c7,_0xf6e0('0xf'));logger[_0xf6e0('0x10')](_0xf6e0('0x11'),_0x47d5c7,_0xf6e0('0xf'),JSON[_0xf6e0('0x12')](_0x4adbf8));if(_0x4adbf8['error']){if(_0x4adbf8[_0xf6e0('0x13')]['code']===0x1f4){logger[_0xf6e0('0x13')](_0xf6e0('0xe'),_0x47d5c7,_0x4adbf8[_0xf6e0('0x13')][_0xf6e0('0x14')]);return _0x2f72c1(_0x4adbf8[_0xf6e0('0x13')][_0xf6e0('0x14')]);}logger[_0xf6e0('0x13')](_0xf6e0('0xe'),_0x47d5c7,_0x4adbf8[_0xf6e0('0x13')]['message']);return _0x2926dd(_0x4adbf8[_0xf6e0('0x13')][_0xf6e0('0x14')]);}else{logger[_0xf6e0('0xd')](_0xf6e0('0xe'),_0x47d5c7,_0xf6e0('0xf'));_0x2926dd(_0x4adbf8['result'][_0xf6e0('0x14')]);}})['catch'](function(_0x1e06ca){logger[_0xf6e0('0x13')](_0xf6e0('0xe'),_0x47d5c7,_0x1e06ca);_0x2f72c1(_0x1e06ca);});});}