Built motion from commit eddce310.|2.6.12
[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 _0x8cda=['../../config/environment','jayson/promise','client','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x22aecc,_0x49e391){var _0x40ad56=function(_0x1f1542){while(--_0x1f1542){_0x22aecc['push'](_0x22aecc['shift']());}};_0x40ad56(++_0x49e391);}(_0x8cda,0xdd));var _0xa8cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8cda[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa8cd('0x0'));var util=require(_0xa8cd('0x1'));var moment=require('moment');var BPromise=require(_0xa8cd('0x2'));var rs=require(_0xa8cd('0x3'));var fs=require('fs');var Redis=require(_0xa8cd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8cd('0x5'));var logger=require(_0xa8cd('0x6'))('rpc');var config=require(_0xa8cd('0x7'));var jayson=require(_0xa8cd('0x8'));var client=jayson[_0xa8cd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bc4f5,_0x518571,_0x130c31){return new BPromise(function(_0x40160d,_0x20e4fb){return client[_0xa8cd('0xa')](_0x4bc4f5,_0x130c31)['then'](function(_0x244f15){logger[_0xa8cd('0xb')](_0xa8cd('0xc'),_0x518571,_0xa8cd('0xd'));logger[_0xa8cd('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x518571,_0xa8cd('0xd'),JSON['stringify'](_0x244f15));if(_0x244f15[_0xa8cd('0xf')]){if(_0x244f15[_0xa8cd('0xf')][_0xa8cd('0x10')]===0x1f4){logger[_0xa8cd('0xf')](_0xa8cd('0xc'),_0x518571,_0x244f15['error']['message']);return _0x20e4fb(_0x244f15[_0xa8cd('0xf')][_0xa8cd('0x11')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x518571,_0x244f15[_0xa8cd('0xf')]['message']);return _0x40160d(_0x244f15[_0xa8cd('0xf')][_0xa8cd('0x11')]);}else{logger[_0xa8cd('0xb')](_0xa8cd('0xc'),_0x518571,_0xa8cd('0xd'));_0x40160d(_0x244f15['result'][_0xa8cd('0x11')]);}})[_0xa8cd('0x12')](function(_0x455497){logger['error']('Schedule,\x20%s,\x20%s',_0x518571,_0x455497);_0x20e4fb(_0x455497);});});}