14193a1709fb4dc8c565e584cb891696cfb98bff
[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 _0x9192=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','CreateReportAgentPreview','options','raw','stringify','lodash','util','moment','ioredis'];(function(_0x450689,_0x3b857c){var _0x46ffb0=function(_0x5d3679){while(--_0x5d3679){_0x450689['push'](_0x450689['shift']());}};_0x46ffb0(++_0x3b857c);}(_0x9192,0xf9));var _0x2919=function(_0x452985,_0x1ca4af){_0x452985=_0x452985-0x0;var _0x115294=_0x9192[_0x452985];return _0x115294;};'use strict';var _=require(_0x2919('0x0'));var util=require(_0x2919('0x1'));var moment=require(_0x2919('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2919('0x3'));var db=require(_0x2919('0x4'))['db'];var utils=require(_0x2919('0x5'));var logger=require(_0x2919('0x6'))(_0x2919('0x7'));var config=require(_0x2919('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2919('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cef5a,_0x26a53c,_0x315aee){return new BPromise(function(_0x5428ea,_0x4cc61a){return client[_0x2919('0xa')](_0x3cef5a,_0x315aee)['then'](function(_0x283fd1){logger[_0x2919('0xb')](_0x2919('0xc'),_0x26a53c,'request\x20sent');logger[_0x2919('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x26a53c,'request\x20sent',JSON['stringify'](_0x283fd1));if(_0x283fd1[_0x2919('0xe')]){if(_0x283fd1[_0x2919('0xe')][_0x2919('0xf')]===0x1f4){logger[_0x2919('0xe')](_0x2919('0xc'),_0x26a53c,_0x283fd1[_0x2919('0xe')]['message']);return _0x4cc61a(_0x283fd1[_0x2919('0xe')]['message']);}logger[_0x2919('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x26a53c,_0x283fd1[_0x2919('0xe')][_0x2919('0x10')]);return _0x5428ea(_0x283fd1['error'][_0x2919('0x10')]);}else{logger[_0x2919('0xb')](_0x2919('0xc'),_0x26a53c,_0x2919('0x11'));_0x5428ea(_0x283fd1['result'][_0x2919('0x10')]);}})[_0x2919('0x12')](function(_0x1c9edd){logger['error'](_0x2919('0xc'),_0x26a53c,_0x1c9edd);_0x4cc61a(_0x1c9edd);});});}exports[_0x2919('0x13')]=function(_0x4aa5c2){var _0x1f194b=this;return new Promise(function(_0x2d2816,_0xeece82){return db['ReportAgentPreview']['create'](_0x4aa5c2['body'],{'raw':_0x4aa5c2[_0x2919('0x14')]?_0x4aa5c2[_0x2919('0x14')][_0x2919('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x38bb98){logger[_0x2919('0xb')](_0x2919('0x13'),_0x4aa5c2);logger[_0x2919('0xd')](_0x2919('0x13'),_0x4aa5c2,JSON[_0x2919('0x16')](_0x38bb98));_0x2d2816(_0x38bb98);})[_0x2919('0x12')](function(_0x3d6b23){logger[_0x2919('0xe')](_0x2919('0x13'),_0x3d6b23[_0x2919('0x10')],_0x4aa5c2);_0xeece82(_0x1f194b[_0x2919('0xe')](0x1f4,_0x3d6b23[_0x2919('0x10')]));});});};