ff51cc16321f442982ba09d1af3f11f9564423d0
[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 _0xe522=['rpc','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4aaea7,_0x2f4598){var _0x4bae83=function(_0x511513){while(--_0x511513){_0x4aaea7['push'](_0x4aaea7['shift']());}};_0x4bae83(++_0x2f4598);}(_0xe522,0xf5));var _0x2e52=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe522[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x2e52('0x0'));var util=require(_0x2e52('0x1'));var moment=require(_0x2e52('0x2'));var BPromise=require(_0x2e52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e52('0x4'));var db=require(_0x2e52('0x5'))['db'];var utils=require(_0x2e52('0x6'));var logger=require('../../config/logger')(_0x2e52('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e52('0x8')][_0x2e52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x452821,_0x4f6829,_0x136db7){return new BPromise(function(_0x32086c,_0x2f7ca6){return client['request'](_0x452821,_0x136db7)[_0x2e52('0xa')](function(_0x28974e){logger[_0x2e52('0xb')](_0x2e52('0xc'),_0x4f6829,_0x2e52('0xd'));logger[_0x2e52('0xe')](_0x2e52('0xf'),_0x4f6829,'request\x20sent',JSON[_0x2e52('0x10')](_0x28974e));if(_0x28974e[_0x2e52('0x11')]){if(_0x28974e[_0x2e52('0x11')][_0x2e52('0x12')]===0x1f4){logger[_0x2e52('0x11')](_0x2e52('0xc'),_0x4f6829,_0x28974e[_0x2e52('0x11')][_0x2e52('0x13')]);return _0x2f7ca6(_0x28974e['error'][_0x2e52('0x13')]);}logger[_0x2e52('0x11')](_0x2e52('0xc'),_0x4f6829,_0x28974e[_0x2e52('0x11')]['message']);return _0x32086c(_0x28974e['error'][_0x2e52('0x13')]);}else{logger[_0x2e52('0xb')](_0x2e52('0xc'),_0x4f6829,_0x2e52('0xd'));_0x32086c(_0x28974e[_0x2e52('0x14')]['message']);}})['catch'](function(_0x44e9cd){logger[_0x2e52('0x11')](_0x2e52('0xc'),_0x4f6829,_0x44e9cd);_0x2f7ca6(_0x44e9cd);});});}