Built motion from commit 911eb874.|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 _0x25ae=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','ReportAgentPreview','body','options','raw','info','CreateReportAgentPreview','lodash','util','moment','bluebird','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x25ae,0x82));var _0xe25a=function(_0xe1e597,_0x57027d){_0xe1e597=_0xe1e597-0x0;var _0x5e2220=_0x25ae[_0xe1e597];return _0x5e2220;};'use strict';var _=require(_0xe25a('0x0'));var util=require(_0xe25a('0x1'));var moment=require(_0xe25a('0x2'));var BPromise=require(_0xe25a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe25a('0x4'));var db=require(_0xe25a('0x5'))['db'];var utils=require(_0xe25a('0x6'));var logger=require('../../config/logger')(_0xe25a('0x7'));var config=require(_0xe25a('0x8'));var jayson=require(_0xe25a('0x9'));var client=jayson[_0xe25a('0xa')][_0xe25a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18b5dc,_0x1aa59f,_0x203e3d){return new BPromise(function(_0x1a81c2,_0xc638c8){return client[_0xe25a('0xc')](_0x18b5dc,_0x203e3d)[_0xe25a('0xd')](function(_0x100fcf){logger['info'](_0xe25a('0xe'),_0x1aa59f,'request\x20sent');logger[_0xe25a('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x1aa59f,_0xe25a('0x10'),JSON['stringify'](_0x100fcf));if(_0x100fcf[_0xe25a('0x11')]){if(_0x100fcf[_0xe25a('0x11')]['code']===0x1f4){logger[_0xe25a('0x11')](_0xe25a('0xe'),_0x1aa59f,_0x100fcf['error']['message']);return _0xc638c8(_0x100fcf['error'][_0xe25a('0x12')]);}logger['error'](_0xe25a('0xe'),_0x1aa59f,_0x100fcf[_0xe25a('0x11')][_0xe25a('0x12')]);return _0x1a81c2(_0x100fcf[_0xe25a('0x11')][_0xe25a('0x12')]);}else{logger['info'](_0xe25a('0xe'),_0x1aa59f,_0xe25a('0x10'));_0x1a81c2(_0x100fcf[_0xe25a('0x13')]['message']);}})[_0xe25a('0x14')](function(_0x404878){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1aa59f,_0x404878);_0xc638c8(_0x404878);});});}exports['CreateReportAgentPreview']=function(_0x3d453a){var _0x373581=this;return new Promise(function(_0x5f41ba,_0x568c0d){return db[_0xe25a('0x15')]['create'](_0x3d453a[_0xe25a('0x16')],{'raw':_0x3d453a[_0xe25a('0x17')]?_0x3d453a['options'][_0xe25a('0x18')]===undefined?!![]:![]:!![]})[_0xe25a('0xd')](function(_0x22d16d){logger[_0xe25a('0x19')](_0xe25a('0x1a'),_0x3d453a);logger[_0xe25a('0xf')]('CreateReportAgentPreview',_0x3d453a,JSON['stringify'](_0x22d16d));_0x5f41ba(_0x22d16d);})[_0xe25a('0x14')](function(_0x1ab1e1){logger[_0xe25a('0x11')](_0xe25a('0x1a'),_0x1ab1e1['message'],_0x3d453a);_0x568c0d(_0x373581['error'](0x1f4,_0x1ab1e1[_0xe25a('0x12')]));});});};