c06f0a2d88df396e4b2f01ee35c051321f394832
[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 _0xf63a=['catch','CreateReportAgentPreview','create','body','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x596c43,_0x31d5fe){var _0x11353a=function(_0xa4015f){while(--_0xa4015f){_0x596c43['push'](_0x596c43['shift']());}};_0x11353a(++_0x31d5fe);}(_0xf63a,0x1d6));var _0xaf63=function(_0x5de505,_0xee5804){_0x5de505=_0x5de505-0x0;var _0x1df98e=_0xf63a[_0x5de505];return _0x1df98e;};'use strict';var _=require(_0xaf63('0x0'));var util=require('util');var moment=require(_0xaf63('0x1'));var BPromise=require(_0xaf63('0x2'));var rs=require(_0xaf63('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf63('0x4'))['db'];var utils=require(_0xaf63('0x5'));var logger=require('../../config/logger')(_0xaf63('0x6'));var config=require(_0xaf63('0x7'));var jayson=require(_0xaf63('0x8'));var client=jayson[_0xaf63('0x9')][_0xaf63('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12ba81,_0x19b1d5,_0x11ca62){return new BPromise(function(_0x5a1710,_0x514f15){return client[_0xaf63('0xb')](_0x12ba81,_0x11ca62)[_0xaf63('0xc')](function(_0x196785){logger['info'](_0xaf63('0xd'),_0x19b1d5,_0xaf63('0xe'));logger[_0xaf63('0xf')](_0xaf63('0x10'),_0x19b1d5,'request\x20sent',JSON[_0xaf63('0x11')](_0x196785));if(_0x196785[_0xaf63('0x12')]){if(_0x196785[_0xaf63('0x12')][_0xaf63('0x13')]===0x1f4){logger[_0xaf63('0x12')](_0xaf63('0xd'),_0x19b1d5,_0x196785['error']['message']);return _0x514f15(_0x196785[_0xaf63('0x12')][_0xaf63('0x14')]);}logger[_0xaf63('0x12')](_0xaf63('0xd'),_0x19b1d5,_0x196785[_0xaf63('0x12')][_0xaf63('0x14')]);return _0x5a1710(_0x196785[_0xaf63('0x12')][_0xaf63('0x14')]);}else{logger[_0xaf63('0x15')](_0xaf63('0xd'),_0x19b1d5,'request\x20sent');_0x5a1710(_0x196785[_0xaf63('0x16')][_0xaf63('0x14')]);}})[_0xaf63('0x17')](function(_0x1aeb95){logger[_0xaf63('0x12')](_0xaf63('0xd'),_0x19b1d5,_0x1aeb95);_0x514f15(_0x1aeb95);});});}exports[_0xaf63('0x18')]=function(_0x327acf){var _0xcee02f=this;return new Promise(function(_0x349880,_0x575583){return db['ReportAgentPreview'][_0xaf63('0x19')](_0x327acf[_0xaf63('0x1a')],{'raw':_0x327acf['options']?_0x327acf[_0xaf63('0x1b')][_0xaf63('0x1c')]===undefined?!![]:![]:!![]})[_0xaf63('0xc')](function(_0x53dfc6){logger[_0xaf63('0x15')](_0xaf63('0x18'),_0x327acf);logger[_0xaf63('0xf')](_0xaf63('0x18'),_0x327acf,JSON[_0xaf63('0x11')](_0x53dfc6));_0x349880(_0x53dfc6);})[_0xaf63('0x17')](function(_0x2452cd){logger[_0xaf63('0x12')](_0xaf63('0x18'),_0x2452cd['message'],_0x327acf);_0x575583(_0xcee02f[_0xaf63('0x12')](0x1f4,_0x2452cd[_0xaf63('0x14')]));});});};