Built motion from commit 616d3211.|2.6.4
[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 _0x36ce=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateReportAgentPreview','create','body','options','raw','catch'];(function(_0x42eaca,_0x1fbbbc){var _0x2832d1=function(_0xa11ed5){while(--_0xa11ed5){_0x42eaca['push'](_0x42eaca['shift']());}};_0x2832d1(++_0x1fbbbc);}(_0x36ce,0x17a));var _0xe36c=function(_0x46975c,_0x166b09){_0x46975c=_0x46975c-0x0;var _0x2c996b=_0x36ce[_0x46975c];return _0x2c996b;};'use strict';var _=require('lodash');var util=require(_0xe36c('0x0'));var moment=require('moment');var BPromise=require(_0xe36c('0x1'));var rs=require(_0xe36c('0x2'));var fs=require('fs');var Redis=require(_0xe36c('0x3'));var db=require(_0xe36c('0x4'))['db'];var utils=require(_0xe36c('0x5'));var logger=require('../../config/logger')(_0xe36c('0x6'));var config=require('../../config/environment');var jayson=require(_0xe36c('0x7'));var client=jayson[_0xe36c('0x8')][_0xe36c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d000f,_0x563780,_0x45c69c){return new BPromise(function(_0xc0505a,_0x118e41){return client[_0xe36c('0xa')](_0x4d000f,_0x45c69c)[_0xe36c('0xb')](function(_0xe2861e){logger[_0xe36c('0xc')](_0xe36c('0xd'),_0x563780,_0xe36c('0xe'));logger[_0xe36c('0xf')](_0xe36c('0x10'),_0x563780,_0xe36c('0xe'),JSON[_0xe36c('0x11')](_0xe2861e));if(_0xe2861e[_0xe36c('0x12')]){if(_0xe2861e[_0xe36c('0x12')][_0xe36c('0x13')]===0x1f4){logger[_0xe36c('0x12')](_0xe36c('0xd'),_0x563780,_0xe2861e[_0xe36c('0x12')]['message']);return _0x118e41(_0xe2861e[_0xe36c('0x12')][_0xe36c('0x14')]);}logger[_0xe36c('0x12')](_0xe36c('0xd'),_0x563780,_0xe2861e[_0xe36c('0x12')][_0xe36c('0x14')]);return _0xc0505a(_0xe2861e['error'][_0xe36c('0x14')]);}else{logger['info'](_0xe36c('0xd'),_0x563780,_0xe36c('0xe'));_0xc0505a(_0xe2861e['result']['message']);}})['catch'](function(_0x565bc4){logger[_0xe36c('0x12')](_0xe36c('0xd'),_0x563780,_0x565bc4);_0x118e41(_0x565bc4);});});}exports[_0xe36c('0x15')]=function(_0x2d5dfe){var _0x486273=this;return new Promise(function(_0x4ba974,_0x3d542e){return db['ReportAgentPreview'][_0xe36c('0x16')](_0x2d5dfe[_0xe36c('0x17')],{'raw':_0x2d5dfe[_0xe36c('0x18')]?_0x2d5dfe[_0xe36c('0x18')][_0xe36c('0x19')]===undefined?!![]:![]:!![]})[_0xe36c('0xb')](function(_0x322be8){logger[_0xe36c('0xc')](_0xe36c('0x15'),_0x2d5dfe);logger['debug'](_0xe36c('0x15'),_0x2d5dfe,JSON[_0xe36c('0x11')](_0x322be8));_0x4ba974(_0x322be8);})[_0xe36c('0x1a')](function(_0x3cadf1){logger[_0xe36c('0x12')](_0xe36c('0x15'),_0x3cadf1['message'],_0x2d5dfe);_0x3d542e(_0x486273['error'](0x1f4,_0x3cadf1[_0xe36c('0x14')]));});});};