Built motion from commit da617fac.|2.6.6
[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 _0x444a=['Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3171a1,_0x236b7c){var _0x40b9c2=function(_0xe51901){while(--_0xe51901){_0x3171a1['push'](_0x3171a1['shift']());}};_0x40b9c2(++_0x236b7c);}(_0x444a,0xf4));var _0xa444=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0x444a[_0x5575cd];return _0x4979a0;};'use strict';var _=require('lodash');var util=require(_0xa444('0x0'));var moment=require(_0xa444('0x1'));var BPromise=require(_0xa444('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa444('0x3'));var db=require(_0xa444('0x4'))['db'];var utils=require(_0xa444('0x5'));var logger=require('../../config/logger')(_0xa444('0x6'));var config=require(_0xa444('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa444('0x8')][_0xa444('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7c1d1b,_0x182892,_0x264043){return new BPromise(function(_0xb5e30b,_0x4980d2){return client[_0xa444('0xa')](_0x7c1d1b,_0x264043)[_0xa444('0xb')](function(_0x9d42e8){logger[_0xa444('0xc')](_0xa444('0xd'),_0x182892,_0xa444('0xe'));logger[_0xa444('0xf')](_0xa444('0x10'),_0x182892,'request\x20sent',JSON[_0xa444('0x11')](_0x9d42e8));if(_0x9d42e8['error']){if(_0x9d42e8['error']['code']===0x1f4){logger['error'](_0xa444('0xd'),_0x182892,_0x9d42e8[_0xa444('0x12')]['message']);return _0x4980d2(_0x9d42e8[_0xa444('0x12')][_0xa444('0x13')]);}logger[_0xa444('0x12')]('Schedule,\x20%s,\x20%s',_0x182892,_0x9d42e8['error']['message']);return _0xb5e30b(_0x9d42e8[_0xa444('0x12')][_0xa444('0x13')]);}else{logger[_0xa444('0xc')](_0xa444('0xd'),_0x182892,'request\x20sent');_0xb5e30b(_0x9d42e8['result'][_0xa444('0x13')]);}})['catch'](function(_0x1aa8aa){logger['error']('Schedule,\x20%s,\x20%s',_0x182892,_0x1aa8aa);_0x4980d2(_0x1aa8aa);});});}