99bb407994e5647216428cfe19a10c7f21dcf50d
[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 _0x7f4b=['Schedule,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x7f4b,0x165));var _0xb7f4=function(_0x281820,_0x47572b){_0x281820=_0x281820-0x0;var _0x2d05f6=_0x7f4b[_0x281820];return _0x2d05f6;};'use strict';var _=require(_0xb7f4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb7f4('0x1'));var fs=require('fs');var Redis=require(_0xb7f4('0x2'));var db=require(_0xb7f4('0x3'))['db'];var utils=require(_0xb7f4('0x4'));var logger=require(_0xb7f4('0x5'))(_0xb7f4('0x6'));var config=require(_0xb7f4('0x7'));var jayson=require(_0xb7f4('0x8'));var client=jayson[_0xb7f4('0x9')][_0xb7f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1104fb,_0x1c6187,_0x2fe69c){return new BPromise(function(_0x11f000,_0x4961af){return client[_0xb7f4('0xb')](_0x1104fb,_0x2fe69c)[_0xb7f4('0xc')](function(_0x4b43b9){logger[_0xb7f4('0xd')](_0xb7f4('0xe'),_0x1c6187,_0xb7f4('0xf'));logger[_0xb7f4('0x10')](_0xb7f4('0x11'),_0x1c6187,_0xb7f4('0xf'),JSON['stringify'](_0x4b43b9));if(_0x4b43b9[_0xb7f4('0x12')]){if(_0x4b43b9['error'][_0xb7f4('0x13')]===0x1f4){logger[_0xb7f4('0x12')](_0xb7f4('0xe'),_0x1c6187,_0x4b43b9[_0xb7f4('0x12')]['message']);return _0x4961af(_0x4b43b9[_0xb7f4('0x12')][_0xb7f4('0x14')]);}logger[_0xb7f4('0x12')]('Schedule,\x20%s,\x20%s',_0x1c6187,_0x4b43b9[_0xb7f4('0x12')][_0xb7f4('0x14')]);return _0x11f000(_0x4b43b9[_0xb7f4('0x12')]['message']);}else{logger[_0xb7f4('0xd')](_0xb7f4('0xe'),_0x1c6187,'request\x20sent');_0x11f000(_0x4b43b9['result'][_0xb7f4('0x14')]);}})[_0xb7f4('0x15')](function(_0x3d68bc){logger['error'](_0xb7f4('0xe'),_0x1c6187,_0x3d68bc);_0x4961af(_0x3d68bc);});});}