Built motion from commit (unavailable).|2.5.31
[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 _0xf5f2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0xf5f2,0x100));var _0x2f5f=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xf5f2[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x2f5f('0x0'));var util=require(_0x2f5f('0x1'));var moment=require(_0x2f5f('0x2'));var BPromise=require(_0x2f5f('0x3'));var rs=require(_0x2f5f('0x4'));var fs=require('fs');var Redis=require(_0x2f5f('0x5'));var db=require(_0x2f5f('0x6'))['db'];var utils=require(_0x2f5f('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f5f('0x8'));var jayson=require(_0x2f5f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28a61d,_0x1b1587,_0x382413){return new BPromise(function(_0x569b14,_0x1a22c5){return client[_0x2f5f('0xa')](_0x28a61d,_0x382413)[_0x2f5f('0xb')](function(_0x4bdf5a){logger[_0x2f5f('0xc')](_0x2f5f('0xd'),_0x1b1587,_0x2f5f('0xe'));logger[_0x2f5f('0xf')](_0x2f5f('0x10'),_0x1b1587,'request\x20sent',JSON[_0x2f5f('0x11')](_0x4bdf5a));if(_0x4bdf5a[_0x2f5f('0x12')]){if(_0x4bdf5a[_0x2f5f('0x12')]['code']===0x1f4){logger[_0x2f5f('0x12')]('Schedule,\x20%s,\x20%s',_0x1b1587,_0x4bdf5a[_0x2f5f('0x12')]['message']);return _0x1a22c5(_0x4bdf5a[_0x2f5f('0x12')][_0x2f5f('0x13')]);}logger[_0x2f5f('0x12')](_0x2f5f('0xd'),_0x1b1587,_0x4bdf5a[_0x2f5f('0x12')][_0x2f5f('0x13')]);return _0x569b14(_0x4bdf5a['error'][_0x2f5f('0x13')]);}else{logger[_0x2f5f('0xc')](_0x2f5f('0xd'),_0x1b1587,'request\x20sent');_0x569b14(_0x4bdf5a['result'][_0x2f5f('0x13')]);}})['catch'](function(_0x69c374){logger[_0x2f5f('0x12')](_0x2f5f('0xd'),_0x1b1587,_0x69c374);_0x1a22c5(_0x69c374);});});}