Built motion from commit (unavailable).|2.5.14
[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 _0x5e77=['options','raw','then','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','client','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateReportAgentPreview','create','body'];(function(_0x36a8b8,_0x59d96c){var _0x539463=function(_0x11209d){while(--_0x11209d){_0x36a8b8['push'](_0x36a8b8['shift']());}};_0x539463(++_0x59d96c);}(_0x5e77,0x100));var _0x75e7=function(_0x49225d,_0x312d6c){_0x49225d=_0x49225d-0x0;var _0x2c228f=_0x5e77[_0x49225d];return _0x2c228f;};'use strict';var _=require(_0x75e7('0x0'));var util=require(_0x75e7('0x1'));var moment=require(_0x75e7('0x2'));var BPromise=require(_0x75e7('0x3'));var rs=require(_0x75e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x75e7('0x5'))('rpc');var config=require(_0x75e7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x75e7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x412366,_0x36113b,_0x40bb35){return new BPromise(function(_0xbf8d7f,_0x59ea15){return client['request'](_0x412366,_0x40bb35)['then'](function(_0x463643){logger[_0x75e7('0x8')](_0x75e7('0x9'),_0x36113b,_0x75e7('0xa'));logger[_0x75e7('0xb')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x36113b,'request\x20sent',JSON[_0x75e7('0xc')](_0x463643));if(_0x463643[_0x75e7('0xd')]){if(_0x463643[_0x75e7('0xd')][_0x75e7('0xe')]===0x1f4){logger[_0x75e7('0xd')](_0x75e7('0x9'),_0x36113b,_0x463643[_0x75e7('0xd')]['message']);return _0x59ea15(_0x463643[_0x75e7('0xd')][_0x75e7('0xf')]);}logger[_0x75e7('0xd')](_0x75e7('0x9'),_0x36113b,_0x463643['error'][_0x75e7('0xf')]);return _0xbf8d7f(_0x463643[_0x75e7('0xd')]['message']);}else{logger[_0x75e7('0x8')]('ReportAgentPreview,\x20%s,\x20%s',_0x36113b,_0x75e7('0xa'));_0xbf8d7f(_0x463643['result'][_0x75e7('0xf')]);}})[_0x75e7('0x10')](function(_0x191b2c){logger['error'](_0x75e7('0x9'),_0x36113b,_0x191b2c);_0x59ea15(_0x191b2c);});});}exports[_0x75e7('0x11')]=function(_0x4a5d93){var _0x339fc2=this;return new Promise(function(_0x3453a7,_0x103162){return db['ReportAgentPreview'][_0x75e7('0x12')](_0x4a5d93[_0x75e7('0x13')],{'raw':_0x4a5d93['options']?_0x4a5d93[_0x75e7('0x14')][_0x75e7('0x15')]===undefined?!![]:![]:!![]})[_0x75e7('0x16')](function(_0x41c24c){logger[_0x75e7('0x8')](_0x75e7('0x11'),_0x4a5d93);logger['debug']('CreateReportAgentPreview',_0x4a5d93,JSON[_0x75e7('0xc')](_0x41c24c));_0x3453a7(_0x41c24c);})[_0x75e7('0x10')](function(_0xd24bd4){logger[_0x75e7('0xd')](_0x75e7('0x11'),_0xd24bd4[_0x75e7('0xf')],_0x4a5d93);_0x103162(_0x339fc2['error'](0x1f4,_0xd24bd4[_0x75e7('0xf')]));});});};