5f86eaa6dfc2ace3aab1dcd50d7da2e03c1b93e2
[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 _0x462e=['catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0xb68695,_0x1881a4){var _0x15a817=function(_0x4d04d6){while(--_0x4d04d6){_0xb68695['push'](_0xb68695['shift']());}};_0x15a817(++_0x1881a4);}(_0x462e,0xf1));var _0xe462=function(_0x5ce8c5,_0x114636){_0x5ce8c5=_0x5ce8c5-0x0;var _0x3592d2=_0x462e[_0x5ce8c5];return _0x3592d2;};'use strict';var _=require(_0xe462('0x0'));var util=require(_0xe462('0x1'));var moment=require(_0xe462('0x2'));var BPromise=require(_0xe462('0x3'));var rs=require(_0xe462('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe462('0x5'))(_0xe462('0x6'));var config=require(_0xe462('0x7'));var jayson=require(_0xe462('0x8'));var client=jayson[_0xe462('0x9')][_0xe462('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cfa78,_0x3beed2,_0x330b95){return new BPromise(function(_0x4b7034,_0x10aec6){return client[_0xe462('0xb')](_0x2cfa78,_0x330b95)[_0xe462('0xc')](function(_0x1165cc){logger[_0xe462('0xd')](_0xe462('0xe'),_0x3beed2,'request\x20sent');logger[_0xe462('0xf')](_0xe462('0x10'),_0x3beed2,_0xe462('0x11'),JSON[_0xe462('0x12')](_0x1165cc));if(_0x1165cc['error']){if(_0x1165cc[_0xe462('0x13')][_0xe462('0x14')]===0x1f4){logger['error'](_0xe462('0xe'),_0x3beed2,_0x1165cc[_0xe462('0x13')][_0xe462('0x15')]);return _0x10aec6(_0x1165cc['error'][_0xe462('0x15')]);}logger['error'](_0xe462('0xe'),_0x3beed2,_0x1165cc[_0xe462('0x13')][_0xe462('0x15')]);return _0x4b7034(_0x1165cc['error'][_0xe462('0x15')]);}else{logger['info'](_0xe462('0xe'),_0x3beed2,_0xe462('0x11'));_0x4b7034(_0x1165cc[_0xe462('0x16')][_0xe462('0x15')]);}})[_0xe462('0x17')](function(_0x10d009){logger['error'](_0xe462('0xe'),_0x3beed2,_0x10d009);_0x10aec6(_0x10d009);});});}