Built motion from commit (unavailable).|2.5.9
[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 _0xbb06=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x498e3c,_0x2455c4){var _0x1e5f5f=function(_0x1d981b){while(--_0x1d981b){_0x498e3c['push'](_0x498e3c['shift']());}};_0x1e5f5f(++_0x2455c4);}(_0xbb06,0x129));var _0x6bb0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbb06[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x6bb0('0x0'));var moment=require(_0x6bb0('0x1'));var BPromise=require(_0x6bb0('0x2'));var rs=require(_0x6bb0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6bb0('0x4'));var logger=require(_0x6bb0('0x5'))(_0x6bb0('0x6'));var config=require('../../config/environment');var jayson=require(_0x6bb0('0x7'));var client=jayson[_0x6bb0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdea45,_0x5959e0,_0x1ddee7){return new BPromise(function(_0x71af1c,_0x19dcd7){return client[_0x6bb0('0x9')](_0xfdea45,_0x1ddee7)[_0x6bb0('0xa')](function(_0x1bbed1){logger['info'](_0x6bb0('0xb'),_0x5959e0,_0x6bb0('0xc'));logger[_0x6bb0('0xd')](_0x6bb0('0xe'),_0x5959e0,_0x6bb0('0xc'),JSON[_0x6bb0('0xf')](_0x1bbed1));if(_0x1bbed1['error']){if(_0x1bbed1[_0x6bb0('0x10')][_0x6bb0('0x11')]===0x1f4){logger[_0x6bb0('0x10')]('Schedule,\x20%s,\x20%s',_0x5959e0,_0x1bbed1[_0x6bb0('0x10')][_0x6bb0('0x12')]);return _0x19dcd7(_0x1bbed1[_0x6bb0('0x10')]['message']);}logger[_0x6bb0('0x10')]('Schedule,\x20%s,\x20%s',_0x5959e0,_0x1bbed1['error']['message']);return _0x71af1c(_0x1bbed1[_0x6bb0('0x10')][_0x6bb0('0x12')]);}else{logger['info'](_0x6bb0('0xb'),_0x5959e0,'request\x20sent');_0x71af1c(_0x1bbed1[_0x6bb0('0x13')][_0x6bb0('0x12')]);}})['catch'](function(_0x675393){logger[_0x6bb0('0x10')]('Schedule,\x20%s,\x20%s',_0x5959e0,_0x675393);_0x19dcd7(_0x675393);});});}