969c28adb1d62eed2026ded69cd14f88849532f7
[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 _0xd742=['stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x279f94,_0x211ea4){var _0x129b6d=function(_0x48ba86){while(--_0x48ba86){_0x279f94['push'](_0x279f94['shift']());}};_0x129b6d(++_0x211ea4);}(_0xd742,0x6a));var _0x2d74=function(_0x2dc457,_0x37b6b9){_0x2dc457=_0x2dc457-0x0;var _0xd65e48=_0xd742[_0x2dc457];return _0xd65e48;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2d74('0x0'));var rs=require(_0x2d74('0x1'));var fs=require('fs');var Redis=require(_0x2d74('0x2'));var db=require(_0x2d74('0x3'))['db'];var utils=require(_0x2d74('0x4'));var logger=require(_0x2d74('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2d74('0x6'));var client=jayson[_0x2d74('0x7')][_0x2d74('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24ee29,_0xdce9c4,_0x2ca46b){return new BPromise(function(_0x4d80e2,_0x4db6ba){return client[_0x2d74('0x9')](_0x24ee29,_0x2ca46b)[_0x2d74('0xa')](function(_0x3f3e90){logger[_0x2d74('0xb')](_0x2d74('0xc'),_0xdce9c4,_0x2d74('0xd'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0xdce9c4,_0x2d74('0xd'),JSON[_0x2d74('0xe')](_0x3f3e90));if(_0x3f3e90[_0x2d74('0xf')]){if(_0x3f3e90['error'][_0x2d74('0x10')]===0x1f4){logger[_0x2d74('0xf')](_0x2d74('0xc'),_0xdce9c4,_0x3f3e90[_0x2d74('0xf')][_0x2d74('0x11')]);return _0x4db6ba(_0x3f3e90[_0x2d74('0xf')]['message']);}logger[_0x2d74('0xf')]('Schedule,\x20%s,\x20%s',_0xdce9c4,_0x3f3e90['error'][_0x2d74('0x11')]);return _0x4d80e2(_0x3f3e90[_0x2d74('0xf')]['message']);}else{logger[_0x2d74('0xb')]('Schedule,\x20%s,\x20%s',_0xdce9c4,'request\x20sent');_0x4d80e2(_0x3f3e90[_0x2d74('0x12')]['message']);}})[_0x2d74('0x13')](function(_0x431bb3){logger['error'](_0x2d74('0xc'),_0xdce9c4,_0x431bb3);_0x4db6ba(_0x431bb3);});});}