Built motion from commit 3c2ce842.|2.6.31
[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 _0x334f=['options','raw','CreateReportAgentPreview','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','ReportAgentPreview','create','body'];(function(_0x573808,_0x44d1ca){var _0x295fd1=function(_0x47b9b4){while(--_0x47b9b4){_0x573808['push'](_0x573808['shift']());}};_0x295fd1(++_0x44d1ca);}(_0x334f,0x18a));var _0xf334=function(_0x1a4b2c,_0x3d2784){_0x1a4b2c=_0x1a4b2c-0x0;var _0xb457f=_0x334f[_0x1a4b2c];return _0xb457f;};'use strict';var _=require('lodash');var util=require(_0xf334('0x0'));var moment=require(_0xf334('0x1'));var BPromise=require(_0xf334('0x2'));var rs=require(_0xf334('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf334('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf334('0x5'))('rpc');var config=require(_0xf334('0x6'));var jayson=require(_0xf334('0x7'));var client=jayson['client'][_0xf334('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e6c9c,_0x2e3cf5,_0x3c4546){return new BPromise(function(_0x90ec29,_0x346f61){return client['request'](_0x5e6c9c,_0x3c4546)[_0xf334('0x9')](function(_0x294f66){logger[_0xf334('0xa')](_0xf334('0xb'),_0x2e3cf5,'request\x20sent');logger[_0xf334('0xc')](_0xf334('0xd'),_0x2e3cf5,_0xf334('0xe'),JSON['stringify'](_0x294f66));if(_0x294f66['error']){if(_0x294f66[_0xf334('0xf')][_0xf334('0x10')]===0x1f4){logger[_0xf334('0xf')](_0xf334('0xb'),_0x2e3cf5,_0x294f66['error'][_0xf334('0x11')]);return _0x346f61(_0x294f66[_0xf334('0xf')][_0xf334('0x11')]);}logger[_0xf334('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x2e3cf5,_0x294f66['error']['message']);return _0x90ec29(_0x294f66[_0xf334('0xf')][_0xf334('0x11')]);}else{logger[_0xf334('0xa')](_0xf334('0xb'),_0x2e3cf5,_0xf334('0xe'));_0x90ec29(_0x294f66['result'][_0xf334('0x11')]);}})[_0xf334('0x12')](function(_0x3805f6){logger[_0xf334('0xf')](_0xf334('0xb'),_0x2e3cf5,_0x3805f6);_0x346f61(_0x3805f6);});});}exports['CreateReportAgentPreview']=function(_0x36049c){var _0x5a766e=this;return new Promise(function(_0x253fb7,_0x9d159c){return db[_0xf334('0x13')][_0xf334('0x14')](_0x36049c[_0xf334('0x15')],{'raw':_0x36049c[_0xf334('0x16')]?_0x36049c[_0xf334('0x16')][_0xf334('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1f6ddc){logger[_0xf334('0xa')](_0xf334('0x18'),_0x36049c);logger['debug']('CreateReportAgentPreview',_0x36049c,JSON[_0xf334('0x19')](_0x1f6ddc));_0x253fb7(_0x1f6ddc);})[_0xf334('0x12')](function(_0x4c2f4c){logger[_0xf334('0xf')](_0xf334('0x18'),_0x4c2f4c[_0xf334('0x11')],_0x36049c);_0x9d159c(_0x5a766e[_0xf334('0xf')](0x1f4,_0x4c2f4c['message']));});});};