Built motion from commit 0900f080.|2.5.45
[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 _0xe830=['stringify','error','code','message','Schedule,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe830,0x149));var _0x0e83=function(_0x30ae26,_0x365e23){_0x30ae26=_0x30ae26-0x0;var _0x47b0a1=_0xe830[_0x30ae26];return _0x47b0a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0e83('0x0'));var BPromise=require(_0x0e83('0x1'));var rs=require(_0x0e83('0x2'));var fs=require('fs');var Redis=require(_0x0e83('0x3'));var db=require(_0x0e83('0x4'))['db'];var utils=require(_0x0e83('0x5'));var logger=require(_0x0e83('0x6'))(_0x0e83('0x7'));var config=require(_0x0e83('0x8'));var jayson=require(_0x0e83('0x9'));var client=jayson[_0x0e83('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x350c4b,_0x3ed162,_0x21b037){return new BPromise(function(_0x29777a,_0x1e7763){return client[_0x0e83('0xb')](_0x350c4b,_0x21b037)[_0x0e83('0xc')](function(_0x2452b9){logger[_0x0e83('0xd')]('Schedule,\x20%s,\x20%s',_0x3ed162,_0x0e83('0xe'));logger[_0x0e83('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x3ed162,_0x0e83('0xe'),JSON[_0x0e83('0x10')](_0x2452b9));if(_0x2452b9[_0x0e83('0x11')]){if(_0x2452b9[_0x0e83('0x11')][_0x0e83('0x12')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x3ed162,_0x2452b9['error'][_0x0e83('0x13')]);return _0x1e7763(_0x2452b9[_0x0e83('0x11')][_0x0e83('0x13')]);}logger['error'](_0x0e83('0x14'),_0x3ed162,_0x2452b9['error'][_0x0e83('0x13')]);return _0x29777a(_0x2452b9['error']['message']);}else{logger['info'](_0x0e83('0x14'),_0x3ed162,_0x0e83('0xe'));_0x29777a(_0x2452b9[_0x0e83('0x15')][_0x0e83('0x13')]);}})[_0x0e83('0x16')](function(_0x4be70e){logger[_0x0e83('0x11')](_0x0e83('0x14'),_0x3ed162,_0x4be70e);_0x1e7763(_0x4be70e);});});}