Built motion from commit (unavailable).|2.5.14
[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 _0x8451=['http','info','request\x20sent','error','code','Schedule,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client'];(function(_0x22093a,_0xa7acf1){var _0x2f4989=function(_0x5bf12b){while(--_0x5bf12b){_0x22093a['push'](_0x22093a['shift']());}};_0x2f4989(++_0xa7acf1);}(_0x8451,0xd4));var _0x1845=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x8451[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x1845('0x0'));var util=require(_0x1845('0x1'));var moment=require('moment');var BPromise=require(_0x1845('0x2'));var rs=require(_0x1845('0x3'));var fs=require('fs');var Redis=require(_0x1845('0x4'));var db=require(_0x1845('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1845('0x6'))(_0x1845('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1845('0x8')][_0x1845('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26a5e8,_0x8ba598,_0x14e17e){return new BPromise(function(_0x1666a9,_0xb91b54){return client['request'](_0x26a5e8,_0x14e17e)['then'](function(_0x24be91){logger[_0x1845('0xa')]('Schedule,\x20%s,\x20%s',_0x8ba598,_0x1845('0xb'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x8ba598,'request\x20sent',JSON['stringify'](_0x24be91));if(_0x24be91['error']){if(_0x24be91[_0x1845('0xc')][_0x1845('0xd')]===0x1f4){logger[_0x1845('0xc')](_0x1845('0xe'),_0x8ba598,_0x24be91[_0x1845('0xc')][_0x1845('0xf')]);return _0xb91b54(_0x24be91[_0x1845('0xc')][_0x1845('0xf')]);}logger[_0x1845('0xc')]('Schedule,\x20%s,\x20%s',_0x8ba598,_0x24be91[_0x1845('0xc')][_0x1845('0xf')]);return _0x1666a9(_0x24be91[_0x1845('0xc')]['message']);}else{logger['info'](_0x1845('0xe'),_0x8ba598,_0x1845('0xb'));_0x1666a9(_0x24be91[_0x1845('0x10')]['message']);}})['catch'](function(_0x256843){logger['error'](_0x1845('0xe'),_0x8ba598,_0x256843);_0xb91b54(_0x256843);});});}