ca3d5a9b8767bfc42c3bc0c4d80373091f7ed14b
[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 _0x8517=['stringify','error','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','debug','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0x8517,0x1d3));var _0x7851=function(_0x3f2e94,_0x591428){_0x3f2e94=_0x3f2e94-0x0;var _0x18349c=_0x8517[_0x3f2e94];return _0x18349c;};'use strict';var _=require('lodash');var util=require(_0x7851('0x0'));var moment=require('moment');var BPromise=require(_0x7851('0x1'));var rs=require(_0x7851('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7851('0x3'))['db'];var utils=require(_0x7851('0x4'));var logger=require('../../config/logger')(_0x7851('0x5'));var config=require('../../config/environment');var jayson=require(_0x7851('0x6'));var client=jayson[_0x7851('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13369d,_0x506fb4,_0x135b5f){return new BPromise(function(_0x2b382b,_0x150f78){return client['request'](_0x13369d,_0x135b5f)[_0x7851('0x8')](function(_0x35316d){logger[_0x7851('0x9')](_0x7851('0xa'),_0x506fb4,'request\x20sent');logger['debug'](_0x7851('0xb'),_0x506fb4,_0x7851('0xc'),JSON[_0x7851('0xd')](_0x35316d));if(_0x35316d[_0x7851('0xe')]){if(_0x35316d['error']['code']===0x1f4){logger[_0x7851('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x506fb4,_0x35316d['error'][_0x7851('0xf')]);return _0x150f78(_0x35316d[_0x7851('0xe')][_0x7851('0xf')]);}logger[_0x7851('0xe')](_0x7851('0xa'),_0x506fb4,_0x35316d[_0x7851('0xe')][_0x7851('0xf')]);return _0x2b382b(_0x35316d[_0x7851('0xe')][_0x7851('0xf')]);}else{logger[_0x7851('0x9')](_0x7851('0xa'),_0x506fb4,_0x7851('0xc'));_0x2b382b(_0x35316d[_0x7851('0x10')][_0x7851('0xf')]);}})[_0x7851('0x11')](function(_0x184a30){logger[_0x7851('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x506fb4,_0x184a30);_0x150f78(_0x184a30);});});}exports[_0x7851('0x12')]=function(_0x18763d){var _0x10781c=this;return new Promise(function(_0x239eeb,_0x456ba1){return db[_0x7851('0x13')][_0x7851('0x14')](_0x18763d[_0x7851('0x15')],{'raw':_0x18763d[_0x7851('0x16')]?_0x18763d['options']['raw']===undefined?!![]:![]:!![]})[_0x7851('0x8')](function(_0x8476f){logger[_0x7851('0x9')](_0x7851('0x12'),_0x18763d);logger[_0x7851('0x17')](_0x7851('0x12'),_0x18763d,JSON[_0x7851('0xd')](_0x8476f));_0x239eeb(_0x8476f);})[_0x7851('0x11')](function(_0x563199){logger['error'](_0x7851('0x12'),_0x563199[_0x7851('0xf')],_0x18763d);_0x456ba1(_0x10781c['error'](0x1f4,_0x563199[_0x7851('0xf')]));});});};