916f0e9fc9d59967907459fa8ea0f1af4d8c949c
[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 _0xcffa=['code','message','result','create','body','options','raw','CreateReportAgentPreview','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error'];(function(_0xd6db21,_0x1d08f3){var _0x3b96a0=function(_0x157017){while(--_0x157017){_0xd6db21['push'](_0xd6db21['shift']());}};_0x3b96a0(++_0x1d08f3);}(_0xcffa,0x96));var _0xacff=function(_0x59305b,_0x3002e5){_0x59305b=_0x59305b-0x0;var _0x47c604=_0xcffa[_0x59305b];return _0x47c604;};'use strict';var _=require(_0xacff('0x0'));var util=require(_0xacff('0x1'));var moment=require(_0xacff('0x2'));var BPromise=require('bluebird');var rs=require(_0xacff('0x3'));var fs=require('fs');var Redis=require(_0xacff('0x4'));var db=require(_0xacff('0x5'))['db'];var utils=require(_0xacff('0x6'));var logger=require('../../config/logger')(_0xacff('0x7'));var config=require(_0xacff('0x8'));var jayson=require(_0xacff('0x9'));var client=jayson[_0xacff('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29cad6,_0x4d8eed,_0x2822dc){return new BPromise(function(_0x502f17,_0x1c8927){return client['request'](_0x29cad6,_0x2822dc)[_0xacff('0xb')](function(_0x138335){logger[_0xacff('0xc')](_0xacff('0xd'),_0x4d8eed,_0xacff('0xe'));logger[_0xacff('0xf')](_0xacff('0x10'),_0x4d8eed,_0xacff('0xe'),JSON['stringify'](_0x138335));if(_0x138335[_0xacff('0x11')]){if(_0x138335['error'][_0xacff('0x12')]===0x1f4){logger[_0xacff('0x11')](_0xacff('0xd'),_0x4d8eed,_0x138335[_0xacff('0x11')]['message']);return _0x1c8927(_0x138335[_0xacff('0x11')][_0xacff('0x13')]);}logger['error'](_0xacff('0xd'),_0x4d8eed,_0x138335[_0xacff('0x11')][_0xacff('0x13')]);return _0x502f17(_0x138335['error']['message']);}else{logger[_0xacff('0xc')](_0xacff('0xd'),_0x4d8eed,_0xacff('0xe'));_0x502f17(_0x138335[_0xacff('0x14')][_0xacff('0x13')]);}})['catch'](function(_0x64768d){logger['error'](_0xacff('0xd'),_0x4d8eed,_0x64768d);_0x1c8927(_0x64768d);});});}exports['CreateReportAgentPreview']=function(_0x5954b7){var _0x64542c=this;return new Promise(function(_0x17e240,_0x334829){return db['ReportAgentPreview'][_0xacff('0x15')](_0x5954b7[_0xacff('0x16')],{'raw':_0x5954b7[_0xacff('0x17')]?_0x5954b7[_0xacff('0x17')][_0xacff('0x18')]===undefined?!![]:![]:!![]})[_0xacff('0xb')](function(_0x28a95d){logger['info'](_0xacff('0x19'),_0x5954b7);logger['debug']('CreateReportAgentPreview',_0x5954b7,JSON[_0xacff('0x1a')](_0x28a95d));_0x17e240(_0x28a95d);})[_0xacff('0x1b')](function(_0x478da6){logger[_0xacff('0x11')](_0xacff('0x19'),_0x478da6[_0xacff('0x13')],_0x5954b7);_0x334829(_0x64542c[_0xacff('0x11')](0x1f4,_0x478da6['message']));});});};