acad6b18d914e4fa890720a39bf8294fc8ce1f2e
[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 _0x7c79=['request','then','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x47a25a,_0x34e3fe){var _0x46eda3=function(_0x161dbd){while(--_0x161dbd){_0x47a25a['push'](_0x47a25a['shift']());}};_0x46eda3(++_0x34e3fe);}(_0x7c79,0x1bf));var _0x97c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c79[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x97c7('0x0'));var util=require('util');var moment=require(_0x97c7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97c7('0x2'))['db'];var utils=require(_0x97c7('0x3'));var logger=require(_0x97c7('0x4'))(_0x97c7('0x5'));var config=require('../../config/environment');var jayson=require(_0x97c7('0x6'));var client=jayson[_0x97c7('0x7')][_0x97c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4353bb,_0x3cf4f5,_0x12f35d){return new BPromise(function(_0x26f166,_0xb1691){return client[_0x97c7('0x9')](_0x4353bb,_0x12f35d)[_0x97c7('0xa')](function(_0x6f4255){logger[_0x97c7('0xb')](_0x97c7('0xc'),_0x3cf4f5,'request\x20sent');logger['debug'](_0x97c7('0xd'),_0x3cf4f5,_0x97c7('0xe'),JSON[_0x97c7('0xf')](_0x6f4255));if(_0x6f4255[_0x97c7('0x10')]){if(_0x6f4255[_0x97c7('0x10')]['code']===0x1f4){logger[_0x97c7('0x10')](_0x97c7('0xc'),_0x3cf4f5,_0x6f4255[_0x97c7('0x10')][_0x97c7('0x11')]);return _0xb1691(_0x6f4255[_0x97c7('0x10')][_0x97c7('0x11')]);}logger[_0x97c7('0x10')](_0x97c7('0xc'),_0x3cf4f5,_0x6f4255[_0x97c7('0x10')][_0x97c7('0x11')]);return _0x26f166(_0x6f4255[_0x97c7('0x10')][_0x97c7('0x11')]);}else{logger[_0x97c7('0xb')](_0x97c7('0xc'),_0x3cf4f5,_0x97c7('0xe'));_0x26f166(_0x6f4255['result']['message']);}})[_0x97c7('0x12')](function(_0x40a573){logger[_0x97c7('0x10')]('Schedule,\x20%s,\x20%s',_0x3cf4f5,_0x40a573);_0xb1691(_0x40a573);});});}