Built motion from commit b0a9a629.|2.6.33
[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 _0xe484=['info','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ReportAgentPreview','create','body','options','raw'];(function(_0x39bcaa,_0x304e2e){var _0x1bdd4e=function(_0x441a8c){while(--_0x441a8c){_0x39bcaa['push'](_0x39bcaa['shift']());}};_0x1bdd4e(++_0x304e2e);}(_0xe484,0x1b4));var _0x4e48=function(_0x46c993,_0x2fbd91){_0x46c993=_0x46c993-0x0;var _0x3e95b2=_0xe484[_0x46c993];return _0x3e95b2;};'use strict';var _=require(_0x4e48('0x0'));var util=require(_0x4e48('0x1'));var moment=require(_0x4e48('0x2'));var BPromise=require(_0x4e48('0x3'));var rs=require(_0x4e48('0x4'));var fs=require('fs');var Redis=require(_0x4e48('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e48('0x6'));var logger=require(_0x4e48('0x7'))(_0x4e48('0x8'));var config=require(_0x4e48('0x9'));var jayson=require(_0x4e48('0xa'));var client=jayson[_0x4e48('0xb')][_0x4e48('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d0d71,_0x3681ed,_0x159375){return new BPromise(function(_0x9c21a4,_0x15a379){return client[_0x4e48('0xd')](_0x1d0d71,_0x159375)[_0x4e48('0xe')](function(_0x41cea0){logger['info'](_0x4e48('0xf'),_0x3681ed,_0x4e48('0x10'));logger[_0x4e48('0x11')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x3681ed,_0x4e48('0x10'),JSON[_0x4e48('0x12')](_0x41cea0));if(_0x41cea0[_0x4e48('0x13')]){if(_0x41cea0[_0x4e48('0x13')][_0x4e48('0x14')]===0x1f4){logger[_0x4e48('0x13')](_0x4e48('0xf'),_0x3681ed,_0x41cea0[_0x4e48('0x13')]['message']);return _0x15a379(_0x41cea0['error']['message']);}logger[_0x4e48('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x3681ed,_0x41cea0['error'][_0x4e48('0x15')]);return _0x9c21a4(_0x41cea0[_0x4e48('0x13')]['message']);}else{logger['info'](_0x4e48('0xf'),_0x3681ed,'request\x20sent');_0x9c21a4(_0x41cea0[_0x4e48('0x16')][_0x4e48('0x15')]);}})[_0x4e48('0x17')](function(_0x113f87){logger[_0x4e48('0x13')](_0x4e48('0xf'),_0x3681ed,_0x113f87);_0x15a379(_0x113f87);});});}exports['CreateReportAgentPreview']=function(_0x141e9b){var _0xb56ca3=this;return new Promise(function(_0x3121e4,_0x5b23a2){return db[_0x4e48('0x18')][_0x4e48('0x19')](_0x141e9b[_0x4e48('0x1a')],{'raw':_0x141e9b[_0x4e48('0x1b')]?_0x141e9b[_0x4e48('0x1b')][_0x4e48('0x1c')]===undefined?!![]:![]:!![]})[_0x4e48('0xe')](function(_0xd6f9d1){logger[_0x4e48('0x1d')](_0x4e48('0x1e'),_0x141e9b);logger[_0x4e48('0x11')](_0x4e48('0x1e'),_0x141e9b,JSON[_0x4e48('0x12')](_0xd6f9d1));_0x3121e4(_0xd6f9d1);})[_0x4e48('0x17')](function(_0x515669){logger[_0x4e48('0x13')]('CreateReportAgentPreview',_0x515669[_0x4e48('0x15')],_0x141e9b);_0x5b23a2(_0xb56ca3[_0x4e48('0x13')](0x1f4,_0x515669[_0x4e48('0x15')]));});});};