Built motion from commit 2b9af5da.|2.6.26
[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 _0xd707=['catch','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Schedule,\x20%s,\x20%s','message','result'];(function(_0x1ad901,_0x852d9e){var _0x3c0249=function(_0x319eda){while(--_0x319eda){_0x1ad901['push'](_0x1ad901['shift']());}};_0x3c0249(++_0x852d9e);}(_0xd707,0xbf));var _0x7d70=function(_0xcce770,_0x128c75){_0xcce770=_0xcce770-0x0;var _0x3d6adf=_0xd707[_0xcce770];return _0x3d6adf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7d70('0x0'));var rs=require(_0x7d70('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7d70('0x2'));var logger=require(_0x7d70('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7d70('0x4'));var client=jayson['client'][_0x7d70('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2c228e,_0x2b4b26,_0x41b4d8){return new BPromise(function(_0x459921,_0x20ce55){return client[_0x7d70('0x6')](_0x2c228e,_0x41b4d8)[_0x7d70('0x7')](function(_0x3cd32b){logger[_0x7d70('0x8')]('Schedule,\x20%s,\x20%s',_0x2b4b26,'request\x20sent');logger[_0x7d70('0x9')](_0x7d70('0xa'),_0x2b4b26,_0x7d70('0xb'),JSON[_0x7d70('0xc')](_0x3cd32b));if(_0x3cd32b[_0x7d70('0xd')]){if(_0x3cd32b[_0x7d70('0xd')][_0x7d70('0xe')]===0x1f4){logger[_0x7d70('0xd')](_0x7d70('0xf'),_0x2b4b26,_0x3cd32b['error'][_0x7d70('0x10')]);return _0x20ce55(_0x3cd32b[_0x7d70('0xd')]['message']);}logger[_0x7d70('0xd')](_0x7d70('0xf'),_0x2b4b26,_0x3cd32b[_0x7d70('0xd')]['message']);return _0x459921(_0x3cd32b[_0x7d70('0xd')]['message']);}else{logger[_0x7d70('0x8')](_0x7d70('0xf'),_0x2b4b26,_0x7d70('0xb'));_0x459921(_0x3cd32b[_0x7d70('0x11')][_0x7d70('0x10')]);}})[_0x7d70('0x12')](function(_0x5ed6ff){logger[_0x7d70('0xd')](_0x7d70('0xf'),_0x2b4b26,_0x5ed6ff);_0x20ce55(_0x5ed6ff);});});}