Built motion from commit (unavailable).|2.5.17
[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 _0x07b3=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5673c6,_0xc302ec){var _0x130bd9=function(_0x1653f5){while(--_0x1653f5){_0x5673c6['push'](_0x5673c6['shift']());}};_0x130bd9(++_0xc302ec);}(_0x07b3,0x175));var _0x307b=function(_0x5d2779,_0x18c619){_0x5d2779=_0x5d2779-0x0;var _0x23b31a=_0x07b3[_0x5d2779];return _0x23b31a;};'use strict';var _=require(_0x307b('0x0'));var util=require(_0x307b('0x1'));var moment=require(_0x307b('0x2'));var BPromise=require(_0x307b('0x3'));var rs=require(_0x307b('0x4'));var fs=require('fs');var Redis=require(_0x307b('0x5'));var db=require(_0x307b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x307b('0x7'))(_0x307b('0x8'));var config=require(_0x307b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x307b('0xa')][_0x307b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bd7cb,_0x113a83,_0x232a6f){return new BPromise(function(_0x36a720,_0x31666d){return client['request'](_0x4bd7cb,_0x232a6f)[_0x307b('0xc')](function(_0x3528b7){logger['info'](_0x307b('0xd'),_0x113a83,_0x307b('0xe'));logger[_0x307b('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x113a83,_0x307b('0xe'),JSON[_0x307b('0x10')](_0x3528b7));if(_0x3528b7[_0x307b('0x11')]){if(_0x3528b7['error'][_0x307b('0x12')]===0x1f4){logger[_0x307b('0x11')](_0x307b('0xd'),_0x113a83,_0x3528b7[_0x307b('0x11')][_0x307b('0x13')]);return _0x31666d(_0x3528b7['error'][_0x307b('0x13')]);}logger[_0x307b('0x11')](_0x307b('0xd'),_0x113a83,_0x3528b7['error']['message']);return _0x36a720(_0x3528b7[_0x307b('0x11')][_0x307b('0x13')]);}else{logger['info'](_0x307b('0xd'),_0x113a83,_0x307b('0xe'));_0x36a720(_0x3528b7['result'][_0x307b('0x13')]);}})[_0x307b('0x14')](function(_0x2fc48a){logger[_0x307b('0x11')](_0x307b('0xd'),_0x113a83,_0x2fc48a);_0x31666d(_0x2fc48a);});});}