a58c2a1292dd004e232d9c2a68d56a5d6b79a3b4
[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 _0xb2d7=['debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x47169f,_0x4901fa){var _0x49b6d0=function(_0x5b833b){while(--_0x5b833b){_0x47169f['push'](_0x47169f['shift']());}};_0x49b6d0(++_0x4901fa);}(_0xb2d7,0x1c2));var _0x7b2d=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0xb2d7[_0x5b6cf1];return _0x46278c;};'use strict';var _=require(_0x7b2d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7b2d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b2d('0x2'));var db=require(_0x7b2d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b2d('0x4'));var config=require('../../config/environment');var jayson=require(_0x7b2d('0x5'));var client=jayson[_0x7b2d('0x6')][_0x7b2d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e9abe,_0x22b68f,_0x27948e){return new BPromise(function(_0x1b3218,_0x429775){return client[_0x7b2d('0x8')](_0x5e9abe,_0x27948e)[_0x7b2d('0x9')](function(_0x4032c4){logger['info'](_0x7b2d('0xa'),_0x22b68f,_0x7b2d('0xb'));logger[_0x7b2d('0xc')](_0x7b2d('0xd'),_0x22b68f,'request\x20sent',JSON[_0x7b2d('0xe')](_0x4032c4));if(_0x4032c4['error']){if(_0x4032c4[_0x7b2d('0xf')][_0x7b2d('0x10')]===0x1f4){logger['error'](_0x7b2d('0xa'),_0x22b68f,_0x4032c4['error'][_0x7b2d('0x11')]);return _0x429775(_0x4032c4['error'][_0x7b2d('0x11')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x22b68f,_0x4032c4[_0x7b2d('0xf')]['message']);return _0x1b3218(_0x4032c4['error'][_0x7b2d('0x11')]);}else{logger[_0x7b2d('0x12')](_0x7b2d('0xa'),_0x22b68f,_0x7b2d('0xb'));_0x1b3218(_0x4032c4[_0x7b2d('0x13')][_0x7b2d('0x11')]);}})[_0x7b2d('0x14')](function(_0x2e7972){logger['error'](_0x7b2d('0xa'),_0x22b68f,_0x2e7972);_0x429775(_0x2e7972);});});}