17aea27a044fa2f031ac6afb3e132cdb2883d9ff
[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 _0x945f=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5e7892,_0x4108d2){var _0x4ece35=function(_0x230b4a){while(--_0x230b4a){_0x5e7892['push'](_0x5e7892['shift']());}};_0x4ece35(++_0x4108d2);}(_0x945f,0x73));var _0xf945=function(_0x4a95b9,_0x179dbd){_0x4a95b9=_0x4a95b9-0x0;var _0xab7147=_0x945f[_0x4a95b9];return _0xab7147;};'use strict';var _=require(_0xf945('0x0'));var util=require(_0xf945('0x1'));var moment=require(_0xf945('0x2'));var BPromise=require(_0xf945('0x3'));var rs=require(_0xf945('0x4'));var fs=require('fs');var Redis=require(_0xf945('0x5'));var db=require(_0xf945('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf945('0x7'))(_0xf945('0x8'));var config=require(_0xf945('0x9'));var jayson=require(_0xf945('0xa'));var client=jayson[_0xf945('0xb')][_0xf945('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x166e54,_0x3b756c,_0x4c8368){return new BPromise(function(_0x5464fb,_0x3adeb4){return client['request'](_0x166e54,_0x4c8368)[_0xf945('0xd')](function(_0x1db22b){logger[_0xf945('0xe')](_0xf945('0xf'),_0x3b756c,_0xf945('0x10'));logger[_0xf945('0x11')](_0xf945('0x12'),_0x3b756c,'request\x20sent',JSON['stringify'](_0x1db22b));if(_0x1db22b[_0xf945('0x13')]){if(_0x1db22b[_0xf945('0x13')][_0xf945('0x14')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x3b756c,_0x1db22b[_0xf945('0x13')]['message']);return _0x3adeb4(_0x1db22b[_0xf945('0x13')][_0xf945('0x15')]);}logger['error'](_0xf945('0xf'),_0x3b756c,_0x1db22b[_0xf945('0x13')][_0xf945('0x15')]);return _0x5464fb(_0x1db22b[_0xf945('0x13')][_0xf945('0x15')]);}else{logger['info'](_0xf945('0xf'),_0x3b756c,'request\x20sent');_0x5464fb(_0x1db22b[_0xf945('0x16')]['message']);}})[_0xf945('0x17')](function(_0x3730b1){logger[_0xf945('0x13')](_0xf945('0xf'),_0x3b756c,_0x3730b1);_0x3adeb4(_0x3730b1);});});}