06b19e278c2c4d6eb846c9a5cbdd4cfbdc690818
[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 _0x623a=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x5410f1,_0x2cf174){var _0x15be05=function(_0xe06a04){while(--_0xe06a04){_0x5410f1['push'](_0x5410f1['shift']());}};_0x15be05(++_0x2cf174);}(_0x623a,0x1ad));var _0xa623=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x623a[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require(_0xa623('0x0'));var moment=require(_0xa623('0x1'));var BPromise=require(_0xa623('0x2'));var rs=require(_0xa623('0x3'));var fs=require('fs');var Redis=require(_0xa623('0x4'));var db=require(_0xa623('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa623('0x6'));var config=require(_0xa623('0x7'));var jayson=require(_0xa623('0x8'));var client=jayson[_0xa623('0x9')][_0xa623('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bf5a6,_0x5a8b3a,_0x7a0c6b){return new BPromise(function(_0x1d2bcf,_0x9b3ad0){return client[_0xa623('0xb')](_0x4bf5a6,_0x7a0c6b)[_0xa623('0xc')](function(_0x4be740){logger[_0xa623('0xd')](_0xa623('0xe'),_0x5a8b3a,_0xa623('0xf'));logger[_0xa623('0x10')](_0xa623('0x11'),_0x5a8b3a,_0xa623('0xf'),JSON[_0xa623('0x12')](_0x4be740));if(_0x4be740[_0xa623('0x13')]){if(_0x4be740['error'][_0xa623('0x14')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x5a8b3a,_0x4be740[_0xa623('0x13')][_0xa623('0x15')]);return _0x9b3ad0(_0x4be740[_0xa623('0x13')][_0xa623('0x15')]);}logger['error'](_0xa623('0xe'),_0x5a8b3a,_0x4be740[_0xa623('0x13')][_0xa623('0x15')]);return _0x1d2bcf(_0x4be740[_0xa623('0x13')]['message']);}else{logger[_0xa623('0xd')]('Schedule,\x20%s,\x20%s',_0x5a8b3a,_0xa623('0xf'));_0x1d2bcf(_0x4be740[_0xa623('0x16')][_0xa623('0x15')]);}})[_0xa623('0x17')](function(_0x31aab5){logger['error'](_0xa623('0xe'),_0x5a8b3a,_0x31aab5);_0x9b3ad0(_0x31aab5);});});}