Built motion from commit f7863d46.|2.5.41
[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 _0x4c08=['raw','info','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','CreateReportAgentPreview','ReportAgentPreview','create','options'];(function(_0x5e8ff8,_0x3e8081){var _0x258962=function(_0x4e5023){while(--_0x4e5023){_0x5e8ff8['push'](_0x5e8ff8['shift']());}};_0x258962(++_0x3e8081);}(_0x4c08,0x188));var _0x84c0=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x4c08[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x84c0('0x0'));var util=require(_0x84c0('0x1'));var moment=require('moment');var BPromise=require(_0x84c0('0x2'));var rs=require(_0x84c0('0x3'));var fs=require('fs');var Redis=require(_0x84c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x84c0('0x5'))(_0x84c0('0x6'));var config=require(_0x84c0('0x7'));var jayson=require(_0x84c0('0x8'));var client=jayson[_0x84c0('0x9')][_0x84c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30c2b5,_0x39e5be,_0x469ead){return new BPromise(function(_0x5802a8,_0x4a1bd4){return client[_0x84c0('0xb')](_0x30c2b5,_0x469ead)[_0x84c0('0xc')](function(_0x166bc0){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x39e5be,'request\x20sent');logger[_0x84c0('0xd')](_0x84c0('0xe'),_0x39e5be,_0x84c0('0xf'),JSON[_0x84c0('0x10')](_0x166bc0));if(_0x166bc0['error']){if(_0x166bc0[_0x84c0('0x11')]['code']===0x1f4){logger['error'](_0x84c0('0x12'),_0x39e5be,_0x166bc0['error'][_0x84c0('0x13')]);return _0x4a1bd4(_0x166bc0[_0x84c0('0x11')]['message']);}logger[_0x84c0('0x11')](_0x84c0('0x12'),_0x39e5be,_0x166bc0[_0x84c0('0x11')][_0x84c0('0x13')]);return _0x5802a8(_0x166bc0['error'][_0x84c0('0x13')]);}else{logger['info'](_0x84c0('0x12'),_0x39e5be,'request\x20sent');_0x5802a8(_0x166bc0['result'][_0x84c0('0x13')]);}})['catch'](function(_0x20a4d9){logger[_0x84c0('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x39e5be,_0x20a4d9);_0x4a1bd4(_0x20a4d9);});});}exports[_0x84c0('0x14')]=function(_0x2b6775){var _0x1cc885=this;return new Promise(function(_0x203665,_0xa565aa){return db[_0x84c0('0x15')][_0x84c0('0x16')](_0x2b6775['body'],{'raw':_0x2b6775[_0x84c0('0x17')]?_0x2b6775[_0x84c0('0x17')][_0x84c0('0x18')]===undefined?!![]:![]:!![]})[_0x84c0('0xc')](function(_0x381291){logger[_0x84c0('0x19')]('CreateReportAgentPreview',_0x2b6775);logger['debug']('CreateReportAgentPreview',_0x2b6775,JSON[_0x84c0('0x10')](_0x381291));_0x203665(_0x381291);})['catch'](function(_0x521097){logger[_0x84c0('0x11')]('CreateReportAgentPreview',_0x521097[_0x84c0('0x13')],_0x2b6775);_0xa565aa(_0x1cc885[_0x84c0('0x11')](0x1f4,_0x521097[_0x84c0('0x13')]));});});};