Built motion from commit a61a4a20.|2.5.46
[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 _0x26e8=['Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x1e689f,_0x1cc074){var _0x465896=function(_0x659d61){while(--_0x659d61){_0x1e689f['push'](_0x1e689f['shift']());}};_0x465896(++_0x1cc074);}(_0x26e8,0xa2));var _0x826e=function(_0x4aec3f,_0x2de89f){_0x4aec3f=_0x4aec3f-0x0;var _0x4f10cc=_0x26e8[_0x4aec3f];return _0x4f10cc;};'use strict';var _=require(_0x826e('0x0'));var util=require(_0x826e('0x1'));var moment=require('moment');var BPromise=require(_0x826e('0x2'));var rs=require(_0x826e('0x3'));var fs=require('fs');var Redis=require(_0x826e('0x4'));var db=require(_0x826e('0x5'))['db'];var utils=require(_0x826e('0x6'));var logger=require('../../config/logger')(_0x826e('0x7'));var config=require(_0x826e('0x8'));var jayson=require(_0x826e('0x9'));var client=jayson['client'][_0x826e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5edcd0,_0x3dd8da,_0x4b0038){return new BPromise(function(_0x4bf6d5,_0x3acbe2){return client[_0x826e('0xb')](_0x5edcd0,_0x4b0038)[_0x826e('0xc')](function(_0x516af9){logger[_0x826e('0xd')](_0x826e('0xe'),_0x3dd8da,_0x826e('0xf'));logger[_0x826e('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x3dd8da,'request\x20sent',JSON[_0x826e('0x11')](_0x516af9));if(_0x516af9['error']){if(_0x516af9[_0x826e('0x12')]['code']===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x3dd8da,_0x516af9[_0x826e('0x12')][_0x826e('0x13')]);return _0x3acbe2(_0x516af9[_0x826e('0x12')][_0x826e('0x13')]);}logger[_0x826e('0x12')](_0x826e('0xe'),_0x3dd8da,_0x516af9[_0x826e('0x12')][_0x826e('0x13')]);return _0x4bf6d5(_0x516af9[_0x826e('0x12')][_0x826e('0x13')]);}else{logger['info'](_0x826e('0xe'),_0x3dd8da,'request\x20sent');_0x4bf6d5(_0x516af9[_0x826e('0x14')][_0x826e('0x13')]);}})[_0x826e('0x15')](function(_0x4592c9){logger[_0x826e('0x12')]('Schedule,\x20%s,\x20%s',_0x3dd8da,_0x4592c9);_0x3acbe2(_0x4592c9);});});}