12cfd6b4e9b13d9c69a2f8b833905404c8405108
[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 _0x5f72=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment'];(function(_0x28a16f,_0x4ec9f8){var _0x12187e=function(_0x4515bd){while(--_0x4515bd){_0x28a16f['push'](_0x28a16f['shift']());}};_0x12187e(++_0x4ec9f8);}(_0x5f72,0x101));var _0x25f7=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x5f72[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x25f7('0x0'));var util=require(_0x25f7('0x1'));var moment=require(_0x25f7('0x2'));var BPromise=require(_0x25f7('0x3'));var rs=require(_0x25f7('0x4'));var fs=require('fs');var Redis=require(_0x25f7('0x5'));var db=require(_0x25f7('0x6'))['db'];var utils=require(_0x25f7('0x7'));var logger=require(_0x25f7('0x8'))(_0x25f7('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x25f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x291065,_0x2e2a35,_0x425a5f){return new BPromise(function(_0x33c182,_0x4be85d){return client['request'](_0x291065,_0x425a5f)[_0x25f7('0xb')](function(_0x101b53){logger['info'](_0x25f7('0xc'),_0x2e2a35,_0x25f7('0xd'));logger['debug'](_0x25f7('0xe'),_0x2e2a35,_0x25f7('0xd'),JSON[_0x25f7('0xf')](_0x101b53));if(_0x101b53[_0x25f7('0x10')]){if(_0x101b53[_0x25f7('0x10')]['code']===0x1f4){logger[_0x25f7('0x10')]('Schedule,\x20%s,\x20%s',_0x2e2a35,_0x101b53[_0x25f7('0x10')]['message']);return _0x4be85d(_0x101b53[_0x25f7('0x10')]['message']);}logger[_0x25f7('0x10')](_0x25f7('0xc'),_0x2e2a35,_0x101b53[_0x25f7('0x10')][_0x25f7('0x11')]);return _0x33c182(_0x101b53['error'][_0x25f7('0x11')]);}else{logger[_0x25f7('0x12')](_0x25f7('0xc'),_0x2e2a35,_0x25f7('0xd'));_0x33c182(_0x101b53['result'][_0x25f7('0x11')]);}})[_0x25f7('0x13')](function(_0x3a2880){logger[_0x25f7('0x10')](_0x25f7('0xc'),_0x2e2a35,_0x3a2880);_0x4be85d(_0x3a2880);});});}