3733499f2f975644479a7765cc593ef3dced3bea
[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 _0xa8c2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x2fb9d8,_0x23d76d){var _0x3765bf=function(_0xed059a){while(--_0xed059a){_0x2fb9d8['push'](_0x2fb9d8['shift']());}};_0x3765bf(++_0x23d76d);}(_0xa8c2,0x19a));var _0x2a8c=function(_0x421e4e,_0x41b11d){_0x421e4e=_0x421e4e-0x0;var _0x287010=_0xa8c2[_0x421e4e];return _0x287010;};'use strict';var _=require(_0x2a8c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2a8c('0x1'));var rs=require(_0x2a8c('0x2'));var fs=require('fs');var Redis=require(_0x2a8c('0x3'));var db=require(_0x2a8c('0x4'))['db'];var utils=require(_0x2a8c('0x5'));var logger=require(_0x2a8c('0x6'))(_0x2a8c('0x7'));var config=require(_0x2a8c('0x8'));var jayson=require(_0x2a8c('0x9'));var client=jayson[_0x2a8c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x355497,_0x5b822a,_0x44c569){return new BPromise(function(_0x47c28f,_0x4dd53a){return client[_0x2a8c('0xb')](_0x355497,_0x44c569)[_0x2a8c('0xc')](function(_0x1943b4){logger[_0x2a8c('0xd')](_0x2a8c('0xe'),_0x5b822a,_0x2a8c('0xf'));logger[_0x2a8c('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x5b822a,_0x2a8c('0xf'),JSON[_0x2a8c('0x11')](_0x1943b4));if(_0x1943b4[_0x2a8c('0x12')]){if(_0x1943b4[_0x2a8c('0x12')][_0x2a8c('0x13')]===0x1f4){logger[_0x2a8c('0x12')]('Schedule,\x20%s,\x20%s',_0x5b822a,_0x1943b4[_0x2a8c('0x12')][_0x2a8c('0x14')]);return _0x4dd53a(_0x1943b4['error'][_0x2a8c('0x14')]);}logger[_0x2a8c('0x12')](_0x2a8c('0xe'),_0x5b822a,_0x1943b4[_0x2a8c('0x12')]['message']);return _0x47c28f(_0x1943b4[_0x2a8c('0x12')][_0x2a8c('0x14')]);}else{logger['info'](_0x2a8c('0xe'),_0x5b822a,_0x2a8c('0xf'));_0x47c28f(_0x1943b4[_0x2a8c('0x15')]['message']);}})[_0x2a8c('0x16')](function(_0x2cb633){logger[_0x2a8c('0x12')](_0x2a8c('0xe'),_0x5b822a,_0x2cb633);_0x4dd53a(_0x2cb633);});});}