847794ca25c9fec8faea979418ea32d72a9f3914
[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 _0xc74f=['stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x48972e,_0x54b45a){var _0xbee19f=function(_0x4f5ee5){while(--_0x4f5ee5){_0x48972e['push'](_0x48972e['shift']());}};_0xbee19f(++_0x54b45a);}(_0xc74f,0x131));var _0xfc74=function(_0x2b5cc9,_0x5d2540){_0x2b5cc9=_0x2b5cc9-0x0;var _0x47909c=_0xc74f[_0x2b5cc9];return _0x47909c;};'use strict';var _=require(_0xfc74('0x0'));var util=require(_0xfc74('0x1'));var moment=require(_0xfc74('0x2'));var BPromise=require(_0xfc74('0x3'));var rs=require(_0xfc74('0x4'));var fs=require('fs');var Redis=require(_0xfc74('0x5'));var db=require(_0xfc74('0x6'))['db'];var utils=require(_0xfc74('0x7'));var logger=require('../../config/logger')(_0xfc74('0x8'));var config=require(_0xfc74('0x9'));var jayson=require(_0xfc74('0xa'));var client=jayson[_0xfc74('0xb')][_0xfc74('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10c4cc,_0x120362,_0x37b46c){return new BPromise(function(_0x1d9d89,_0x48f3c8){return client['request'](_0x10c4cc,_0x37b46c)['then'](function(_0x3d4da9){logger['info'](_0xfc74('0xd'),_0x120362,_0xfc74('0xe'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x120362,'request\x20sent',JSON[_0xfc74('0xf')](_0x3d4da9));if(_0x3d4da9[_0xfc74('0x10')]){if(_0x3d4da9['error']['code']===0x1f4){logger[_0xfc74('0x10')](_0xfc74('0xd'),_0x120362,_0x3d4da9[_0xfc74('0x10')]['message']);return _0x48f3c8(_0x3d4da9['error'][_0xfc74('0x11')]);}logger['error'](_0xfc74('0xd'),_0x120362,_0x3d4da9[_0xfc74('0x10')][_0xfc74('0x11')]);return _0x1d9d89(_0x3d4da9[_0xfc74('0x10')][_0xfc74('0x11')]);}else{logger[_0xfc74('0x12')](_0xfc74('0xd'),_0x120362,'request\x20sent');_0x1d9d89(_0x3d4da9[_0xfc74('0x13')][_0xfc74('0x11')]);}})['catch'](function(_0x33e6fe){logger['error'](_0xfc74('0xd'),_0x120362,_0x33e6fe);_0x48f3c8(_0x33e6fe);});});}