Built motion from commit (unavailable).|2.5.30
[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 _0xcb3a=['result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','stringify','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','ReportAgentPreview,\x20%s,\x20%s','message'];(function(_0x3acc1d,_0x1d461b){var _0x2adab8=function(_0x1f5154){while(--_0x1f5154){_0x3acc1d['push'](_0x3acc1d['shift']());}};_0x2adab8(++_0x1d461b);}(_0xcb3a,0x131));var _0xacb3=function(_0x25378d,_0xa87ed){_0x25378d=_0x25378d-0x0;var _0x38a031=_0xcb3a[_0x25378d];return _0x38a031;};'use strict';var _=require(_0xacb3('0x0'));var util=require(_0xacb3('0x1'));var moment=require('moment');var BPromise=require(_0xacb3('0x2'));var rs=require(_0xacb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xacb3('0x4'))(_0xacb3('0x5'));var config=require(_0xacb3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xacb3('0x7')][_0xacb3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5402f6,_0x330d7d,_0x2710da){return new BPromise(function(_0x44539a,_0x35f624){return client[_0xacb3('0x9')](_0x5402f6,_0x2710da)[_0xacb3('0xa')](function(_0x5b4c83){logger[_0xacb3('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x330d7d,_0xacb3('0xc'));logger[_0xacb3('0xd')](_0xacb3('0xe'),_0x330d7d,_0xacb3('0xc'),JSON['stringify'](_0x5b4c83));if(_0x5b4c83[_0xacb3('0xf')]){if(_0x5b4c83[_0xacb3('0xf')][_0xacb3('0x10')]===0x1f4){logger[_0xacb3('0xf')](_0xacb3('0x11'),_0x330d7d,_0x5b4c83['error'][_0xacb3('0x12')]);return _0x35f624(_0x5b4c83['error']['message']);}logger['error'](_0xacb3('0x11'),_0x330d7d,_0x5b4c83[_0xacb3('0xf')][_0xacb3('0x12')]);return _0x44539a(_0x5b4c83[_0xacb3('0xf')]['message']);}else{logger[_0xacb3('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x330d7d,_0xacb3('0xc'));_0x44539a(_0x5b4c83[_0xacb3('0x13')]['message']);}})[_0xacb3('0x14')](function(_0x128ca1){logger['error'](_0xacb3('0x11'),_0x330d7d,_0x128ca1);_0x35f624(_0x128ca1);});});}exports[_0xacb3('0x15')]=function(_0x563465){var _0x11cc18=this;return new Promise(function(_0x33f43c,_0x3ff0e0){return db[_0xacb3('0x16')]['create'](_0x563465[_0xacb3('0x17')],{'raw':_0x563465[_0xacb3('0x18')]?_0x563465[_0xacb3('0x18')][_0xacb3('0x19')]===undefined?!![]:![]:!![]})[_0xacb3('0xa')](function(_0x2b9c03){logger[_0xacb3('0xb')](_0xacb3('0x15'),_0x563465);logger[_0xacb3('0xd')](_0xacb3('0x15'),_0x563465,JSON[_0xacb3('0x1a')](_0x2b9c03));_0x33f43c(_0x2b9c03);})['catch'](function(_0x4643ff){logger[_0xacb3('0xf')](_0xacb3('0x15'),_0x4643ff[_0xacb3('0x12')],_0x563465);_0x3ff0e0(_0x11cc18['error'](0x1f4,_0x4643ff[_0xacb3('0x12')]));});});};