Built motion from commit f94df7f0.|2.5.48
[motion2.git] / server / api / reportAgentPreview / reportAgentPreview.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 _0x400c=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','CreateReportAgentPreview','create','body','options','raw','then','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x436001,_0x14a33f){var _0x230fae=function(_0x4cb5bb){while(--_0x4cb5bb){_0x436001['push'](_0x436001['shift']());}};_0x230fae(++_0x14a33f);}(_0x400c,0x81));var _0xc400=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x400c[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xc400('0x0'));var util=require(_0xc400('0x1'));var moment=require('moment');var BPromise=require(_0xc400('0x2'));var rs=require(_0xc400('0x3'));var fs=require('fs');var Redis=require(_0xc400('0x4'));var db=require(_0xc400('0x5'))['db'];var utils=require(_0xc400('0x6'));var logger=require(_0xc400('0x7'))(_0xc400('0x8'));var config=require('../../config/environment');var jayson=require(_0xc400('0x9'));var client=jayson[_0xc400('0xa')][_0xc400('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f46cf,_0x222d1e,_0x51bab3){return new BPromise(function(_0x19b2d0,_0x5926dd){return client[_0xc400('0xc')](_0x5f46cf,_0x51bab3)['then'](function(_0x45823e){logger[_0xc400('0xd')](_0xc400('0xe'),_0x222d1e,_0xc400('0xf'));logger[_0xc400('0x10')](_0xc400('0x11'),_0x222d1e,_0xc400('0xf'),JSON['stringify'](_0x45823e));if(_0x45823e[_0xc400('0x12')]){if(_0x45823e[_0xc400('0x12')]['code']===0x1f4){logger[_0xc400('0x12')](_0xc400('0xe'),_0x222d1e,_0x45823e[_0xc400('0x12')]['message']);return _0x5926dd(_0x45823e[_0xc400('0x12')][_0xc400('0x13')]);}logger[_0xc400('0x12')](_0xc400('0xe'),_0x222d1e,_0x45823e[_0xc400('0x12')][_0xc400('0x13')]);return _0x19b2d0(_0x45823e['error']['message']);}else{logger[_0xc400('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x222d1e,_0xc400('0xf'));_0x19b2d0(_0x45823e['result'][_0xc400('0x13')]);}})['catch'](function(_0x146c94){logger['error'](_0xc400('0xe'),_0x222d1e,_0x146c94);_0x5926dd(_0x146c94);});});}exports[_0xc400('0x14')]=function(_0x21ead5){var _0x283739=this;return new Promise(function(_0x1cc424,_0x4ea178){return db['ReportAgentPreview'][_0xc400('0x15')](_0x21ead5[_0xc400('0x16')],{'raw':_0x21ead5[_0xc400('0x17')]?_0x21ead5[_0xc400('0x17')][_0xc400('0x18')]===undefined?!![]:![]:!![]})[_0xc400('0x19')](function(_0x52adf1){logger[_0xc400('0xd')]('CreateReportAgentPreview',_0x21ead5);logger[_0xc400('0x10')](_0xc400('0x14'),_0x21ead5,JSON['stringify'](_0x52adf1));_0x1cc424(_0x52adf1);})[_0xc400('0x1a')](function(_0x2e5a26){logger[_0xc400('0x12')](_0xc400('0x14'),_0x2e5a26[_0xc400('0x13')],_0x21ead5);_0x4ea178(_0x283739['error'](0x1f4,_0x2e5a26[_0xc400('0x13')]));});});};