55ab157193550d14e7f006225dcfe99b8bc0d1b9
[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 _0xf254=['then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf254,0x1c2));var _0x4f25=function(_0x1ccb95,_0x1b3be8){_0x1ccb95=_0x1ccb95-0x0;var _0x1a9725=_0xf254[_0x1ccb95];return _0x1a9725;};'use strict';var _=require(_0x4f25('0x0'));var util=require('util');var moment=require(_0x4f25('0x1'));var BPromise=require(_0x4f25('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f25('0x3'));var db=require(_0x4f25('0x4'))['db'];var utils=require(_0x4f25('0x5'));var logger=require(_0x4f25('0x6'))(_0x4f25('0x7'));var config=require(_0x4f25('0x8'));var jayson=require(_0x4f25('0x9'));var client=jayson['client'][_0x4f25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1828ea,_0x534db9,_0x156696){return new BPromise(function(_0x47c797,_0x2ff989){return client[_0x4f25('0xb')](_0x1828ea,_0x156696)[_0x4f25('0xc')](function(_0x5e11c4){logger[_0x4f25('0xd')](_0x4f25('0xe'),_0x534db9,'request\x20sent');logger[_0x4f25('0xf')](_0x4f25('0x10'),_0x534db9,'request\x20sent',JSON[_0x4f25('0x11')](_0x5e11c4));if(_0x5e11c4[_0x4f25('0x12')]){if(_0x5e11c4[_0x4f25('0x12')]['code']===0x1f4){logger[_0x4f25('0x12')]('Schedule,\x20%s,\x20%s',_0x534db9,_0x5e11c4[_0x4f25('0x12')][_0x4f25('0x13')]);return _0x2ff989(_0x5e11c4[_0x4f25('0x12')][_0x4f25('0x13')]);}logger[_0x4f25('0x12')](_0x4f25('0xe'),_0x534db9,_0x5e11c4[_0x4f25('0x12')]['message']);return _0x47c797(_0x5e11c4[_0x4f25('0x12')]['message']);}else{logger[_0x4f25('0xd')](_0x4f25('0xe'),_0x534db9,'request\x20sent');_0x47c797(_0x5e11c4[_0x4f25('0x14')][_0x4f25('0x13')]);}})[_0x4f25('0x15')](function(_0x259384){logger[_0x4f25('0x12')](_0x4f25('0xe'),_0x534db9,_0x259384);_0x2ff989(_0x259384);});});}