8642bc4d7fe880133482d16e49d7fe5496659137
[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 _0x191b=['code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3406d9,_0x3284a8){var _0x34f0c0=function(_0xe750b7){while(--_0xe750b7){_0x3406d9['push'](_0x3406d9['shift']());}};_0x34f0c0(++_0x3284a8);}(_0x191b,0xf5));var _0xb191=function(_0x1fbee5,_0x30d530){_0x1fbee5=_0x1fbee5-0x0;var _0x44128e=_0x191b[_0x1fbee5];return _0x44128e;};'use strict';var _=require(_0xb191('0x0'));var util=require(_0xb191('0x1'));var moment=require(_0xb191('0x2'));var BPromise=require('bluebird');var rs=require(_0xb191('0x3'));var fs=require('fs');var Redis=require(_0xb191('0x4'));var db=require(_0xb191('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb191('0x6'))(_0xb191('0x7'));var config=require('../../config/environment');var jayson=require(_0xb191('0x8'));var client=jayson[_0xb191('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x472989,_0x1daf13,_0x3c690b){return new BPromise(function(_0x4caff5,_0x2290b0){return client[_0xb191('0xa')](_0x472989,_0x3c690b)[_0xb191('0xb')](function(_0x4e8bcc){logger[_0xb191('0xc')](_0xb191('0xd'),_0x1daf13,_0xb191('0xe'));logger[_0xb191('0xf')](_0xb191('0x10'),_0x1daf13,'request\x20sent',JSON[_0xb191('0x11')](_0x4e8bcc));if(_0x4e8bcc[_0xb191('0x12')]){if(_0x4e8bcc[_0xb191('0x12')][_0xb191('0x13')]===0x1f4){logger[_0xb191('0x12')]('Schedule,\x20%s,\x20%s',_0x1daf13,_0x4e8bcc[_0xb191('0x12')]['message']);return _0x2290b0(_0x4e8bcc[_0xb191('0x12')][_0xb191('0x14')]);}logger[_0xb191('0x12')](_0xb191('0xd'),_0x1daf13,_0x4e8bcc['error']['message']);return _0x4caff5(_0x4e8bcc[_0xb191('0x12')][_0xb191('0x14')]);}else{logger[_0xb191('0xc')]('Schedule,\x20%s,\x20%s',_0x1daf13,_0xb191('0xe'));_0x4caff5(_0x4e8bcc['result'][_0xb191('0x14')]);}})[_0xb191('0x15')](function(_0x316fc2){logger[_0xb191('0x12')](_0xb191('0xd'),_0x1daf13,_0x316fc2);_0x2290b0(_0x316fc2);});});}