Built motion from commit 42801a18.|2.6.28
[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 _0xb58b=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x48c1cc,_0x11ebf9){var _0x52072a=function(_0x4efea5){while(--_0x4efea5){_0x48c1cc['push'](_0x48c1cc['shift']());}};_0x52072a(++_0x11ebf9);}(_0xb58b,0x6a));var _0xbb58=function(_0x2de2a3,_0x31d605){_0x2de2a3=_0x2de2a3-0x0;var _0x28c038=_0xb58b[_0x2de2a3];return _0x28c038;};'use strict';var _=require(_0xbb58('0x0'));var util=require(_0xbb58('0x1'));var moment=require(_0xbb58('0x2'));var BPromise=require('bluebird');var rs=require(_0xbb58('0x3'));var fs=require('fs');var Redis=require(_0xbb58('0x4'));var db=require(_0xbb58('0x5'))['db'];var utils=require(_0xbb58('0x6'));var logger=require('../../config/logger')(_0xbb58('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbb58('0x8')][_0xbb58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b0263,_0x41c57f,_0x1f8a93){return new BPromise(function(_0x25d65c,_0x22b2ce){return client[_0xbb58('0xa')](_0x2b0263,_0x1f8a93)[_0xbb58('0xb')](function(_0x45a06f){logger[_0xbb58('0xc')](_0xbb58('0xd'),_0x41c57f,_0xbb58('0xe'));logger['debug'](_0xbb58('0xf'),_0x41c57f,'request\x20sent',JSON[_0xbb58('0x10')](_0x45a06f));if(_0x45a06f['error']){if(_0x45a06f[_0xbb58('0x11')][_0xbb58('0x12')]===0x1f4){logger[_0xbb58('0x11')](_0xbb58('0xd'),_0x41c57f,_0x45a06f[_0xbb58('0x11')][_0xbb58('0x13')]);return _0x22b2ce(_0x45a06f['error'][_0xbb58('0x13')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x41c57f,_0x45a06f[_0xbb58('0x11')][_0xbb58('0x13')]);return _0x25d65c(_0x45a06f['error'][_0xbb58('0x13')]);}else{logger[_0xbb58('0xc')](_0xbb58('0xd'),_0x41c57f,'request\x20sent');_0x25d65c(_0x45a06f['result'][_0xbb58('0x13')]);}})[_0xbb58('0x14')](function(_0x50e977){logger[_0xbb58('0x11')]('Schedule,\x20%s,\x20%s',_0x41c57f,_0x50e977);_0x22b2ce(_0x50e977);});});}