Built motion from commit (unavailable).|2.5.4
[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 _0x1652=['request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0x1652,0x102));var _0x2165=function(_0x1b01f6,_0x57d583){_0x1b01f6=_0x1b01f6-0x0;var _0x1f67af=_0x1652[_0x1b01f6];return _0x1f67af;};'use strict';var _=require(_0x2165('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2165('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x2165('0x2'));var logger=require(_0x2165('0x3'))('rpc');var config=require(_0x2165('0x4'));var jayson=require(_0x2165('0x5'));var client=jayson[_0x2165('0x6')][_0x2165('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43b74d,_0x1bc137,_0x3d64f7){return new BPromise(function(_0x1e50b0,_0xeae905){return client[_0x2165('0x8')](_0x43b74d,_0x3d64f7)[_0x2165('0x9')](function(_0x10d70b){logger[_0x2165('0xa')](_0x2165('0xb'),_0x1bc137,_0x2165('0xc'));logger[_0x2165('0xd')](_0x2165('0xe'),_0x1bc137,_0x2165('0xc'),JSON[_0x2165('0xf')](_0x10d70b));if(_0x10d70b[_0x2165('0x10')]){if(_0x10d70b['error']['code']===0x1f4){logger[_0x2165('0x10')](_0x2165('0xb'),_0x1bc137,_0x10d70b['error'][_0x2165('0x11')]);return _0xeae905(_0x10d70b[_0x2165('0x10')][_0x2165('0x11')]);}logger[_0x2165('0x10')](_0x2165('0xb'),_0x1bc137,_0x10d70b[_0x2165('0x10')][_0x2165('0x11')]);return _0x1e50b0(_0x10d70b[_0x2165('0x10')][_0x2165('0x11')]);}else{logger[_0x2165('0xa')](_0x2165('0xb'),_0x1bc137,_0x2165('0xc'));_0x1e50b0(_0x10d70b['result'][_0x2165('0x11')]);}})[_0x2165('0x12')](function(_0x4e38e0){logger[_0x2165('0x10')](_0x2165('0xb'),_0x1bc137,_0x4e38e0);_0xeae905(_0x4e38e0);});});}