Built motion from commit f0b1811d.|2.6.6
[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 _0x4b27=['Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x520b0d,_0x32d10d){var _0x1a6850=function(_0xf54da4){while(--_0xf54da4){_0x520b0d['push'](_0x520b0d['shift']());}};_0x1a6850(++_0x32d10d);}(_0x4b27,0x182));var _0x74b2=function(_0x3fa42f,_0x3ea16e){_0x3fa42f=_0x3fa42f-0x0;var _0x9b990b=_0x4b27[_0x3fa42f];return _0x9b990b;};'use strict';var _=require('lodash');var util=require(_0x74b2('0x0'));var moment=require('moment');var BPromise=require(_0x74b2('0x1'));var rs=require(_0x74b2('0x2'));var fs=require('fs');var Redis=require(_0x74b2('0x3'));var db=require(_0x74b2('0x4'))['db'];var utils=require(_0x74b2('0x5'));var logger=require(_0x74b2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x74b2('0x7'));var client=jayson[_0x74b2('0x8')][_0x74b2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x295a35,_0x1e6115,_0xe5d891){return new BPromise(function(_0x3c6689,_0x2c162a){return client['request'](_0x295a35,_0xe5d891)[_0x74b2('0xa')](function(_0x5d8c04){logger[_0x74b2('0xb')](_0x74b2('0xc'),_0x1e6115,_0x74b2('0xd'));logger['debug'](_0x74b2('0xe'),_0x1e6115,_0x74b2('0xd'),JSON[_0x74b2('0xf')](_0x5d8c04));if(_0x5d8c04[_0x74b2('0x10')]){if(_0x5d8c04[_0x74b2('0x10')]['code']===0x1f4){logger['error'](_0x74b2('0xc'),_0x1e6115,_0x5d8c04[_0x74b2('0x10')][_0x74b2('0x11')]);return _0x2c162a(_0x5d8c04[_0x74b2('0x10')][_0x74b2('0x11')]);}logger[_0x74b2('0x10')]('Schedule,\x20%s,\x20%s',_0x1e6115,_0x5d8c04[_0x74b2('0x10')]['message']);return _0x3c6689(_0x5d8c04[_0x74b2('0x10')][_0x74b2('0x11')]);}else{logger[_0x74b2('0xb')](_0x74b2('0xc'),_0x1e6115,_0x74b2('0xd'));_0x3c6689(_0x5d8c04[_0x74b2('0x12')][_0x74b2('0x11')]);}})[_0x74b2('0x13')](function(_0x25874b){logger[_0x74b2('0x10')](_0x74b2('0xc'),_0x1e6115,_0x25874b);_0x2c162a(_0x25874b);});});}