Built motion from commit (unavailable).|2.5.4
[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 _0x6f9c=['result','catch','CreateReportAgentPreview','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6f9c,0x1ca));var _0xc6f9=function(_0x5e8647,_0x485754){_0x5e8647=_0x5e8647-0x0;var _0x699cc8=_0x6f9c[_0x5e8647];return _0x699cc8;};'use strict';var _=require(_0xc6f9('0x0'));var util=require(_0xc6f9('0x1'));var moment=require(_0xc6f9('0x2'));var BPromise=require(_0xc6f9('0x3'));var rs=require(_0xc6f9('0x4'));var fs=require('fs');var Redis=require(_0xc6f9('0x5'));var db=require(_0xc6f9('0x6'))['db'];var utils=require(_0xc6f9('0x7'));var logger=require(_0xc6f9('0x8'))('rpc');var config=require(_0xc6f9('0x9'));var jayson=require(_0xc6f9('0xa'));var client=jayson[_0xc6f9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55b16e,_0x204bba,_0x2a9111){return new BPromise(function(_0x596846,_0x1e3e16){return client[_0xc6f9('0xc')](_0x55b16e,_0x2a9111)['then'](function(_0x23bf68){logger[_0xc6f9('0xd')](_0xc6f9('0xe'),_0x204bba,'request\x20sent');logger[_0xc6f9('0xf')](_0xc6f9('0x10'),_0x204bba,_0xc6f9('0x11'),JSON[_0xc6f9('0x12')](_0x23bf68));if(_0x23bf68[_0xc6f9('0x13')]){if(_0x23bf68['error'][_0xc6f9('0x14')]===0x1f4){logger[_0xc6f9('0x13')](_0xc6f9('0xe'),_0x204bba,_0x23bf68['error'][_0xc6f9('0x15')]);return _0x1e3e16(_0x23bf68[_0xc6f9('0x13')][_0xc6f9('0x15')]);}logger[_0xc6f9('0x13')](_0xc6f9('0xe'),_0x204bba,_0x23bf68[_0xc6f9('0x13')][_0xc6f9('0x15')]);return _0x596846(_0x23bf68[_0xc6f9('0x13')][_0xc6f9('0x15')]);}else{logger[_0xc6f9('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x204bba,_0xc6f9('0x11'));_0x596846(_0x23bf68[_0xc6f9('0x16')]['message']);}})[_0xc6f9('0x17')](function(_0x42164f){logger[_0xc6f9('0x13')](_0xc6f9('0xe'),_0x204bba,_0x42164f);_0x1e3e16(_0x42164f);});});}exports[_0xc6f9('0x18')]=function(_0x273a62){var _0xb0b51a=this;return new Promise(function(_0x2631df,_0x5e7026){return db['ReportAgentPreview'][_0xc6f9('0x19')](_0x273a62[_0xc6f9('0x1a')],{'raw':_0x273a62[_0xc6f9('0x1b')]?_0x273a62['options'][_0xc6f9('0x1c')]===undefined?!![]:![]:!![]})[_0xc6f9('0x1d')](function(_0x498927){logger[_0xc6f9('0xd')](_0xc6f9('0x18'),_0x273a62);logger[_0xc6f9('0xf')]('CreateReportAgentPreview',_0x273a62,JSON[_0xc6f9('0x12')](_0x498927));_0x2631df(_0x498927);})['catch'](function(_0x4addeb){logger[_0xc6f9('0x13')](_0xc6f9('0x18'),_0x4addeb[_0xc6f9('0x15')],_0x273a62);_0x5e7026(_0xb0b51a[_0xc6f9('0x13')](0x1f4,_0x4addeb['message']));});});};