Built motion from commit 3c2ce842.|2.6.31
[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 _0x676a=['raw','CreateReportAgentPreview','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ReportAgentPreview','options'];(function(_0x3d9287,_0x12b2f1){var _0x28e30d=function(_0xb18d29){while(--_0xb18d29){_0x3d9287['push'](_0x3d9287['shift']());}};_0x28e30d(++_0x12b2f1);}(_0x676a,0x1dd));var _0xa676=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x676a[_0x4e1d03];return _0x362d4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa676('0x0'));var BPromise=require(_0xa676('0x1'));var rs=require(_0xa676('0x2'));var fs=require('fs');var Redis=require(_0xa676('0x3'));var db=require(_0xa676('0x4'))['db'];var utils=require(_0xa676('0x5'));var logger=require('../../config/logger')(_0xa676('0x6'));var config=require('../../config/environment');var jayson=require(_0xa676('0x7'));var client=jayson[_0xa676('0x8')][_0xa676('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31e081,_0x21791c,_0x4375e0){return new BPromise(function(_0x513c5c,_0x1f5472){return client[_0xa676('0xa')](_0x31e081,_0x4375e0)['then'](function(_0x25412e){logger[_0xa676('0xb')](_0xa676('0xc'),_0x21791c,'request\x20sent');logger[_0xa676('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x21791c,_0xa676('0xe'),JSON[_0xa676('0xf')](_0x25412e));if(_0x25412e[_0xa676('0x10')]){if(_0x25412e[_0xa676('0x10')][_0xa676('0x11')]===0x1f4){logger[_0xa676('0x10')](_0xa676('0xc'),_0x21791c,_0x25412e[_0xa676('0x10')][_0xa676('0x12')]);return _0x1f5472(_0x25412e[_0xa676('0x10')][_0xa676('0x12')]);}logger[_0xa676('0x10')](_0xa676('0xc'),_0x21791c,_0x25412e['error'][_0xa676('0x12')]);return _0x513c5c(_0x25412e[_0xa676('0x10')][_0xa676('0x12')]);}else{logger[_0xa676('0xb')](_0xa676('0xc'),_0x21791c,_0xa676('0xe'));_0x513c5c(_0x25412e[_0xa676('0x13')][_0xa676('0x12')]);}})[_0xa676('0x14')](function(_0x278692){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x21791c,_0x278692);_0x1f5472(_0x278692);});});}exports['CreateReportAgentPreview']=function(_0x252d3a){var _0x3dc270=this;return new Promise(function(_0x553b3b,_0x2c22ce){return db[_0xa676('0x15')]['create'](_0x252d3a['body'],{'raw':_0x252d3a[_0xa676('0x16')]?_0x252d3a[_0xa676('0x16')][_0xa676('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x2b71ae){logger[_0xa676('0xb')](_0xa676('0x18'),_0x252d3a);logger[_0xa676('0xd')](_0xa676('0x18'),_0x252d3a,JSON[_0xa676('0xf')](_0x2b71ae));_0x553b3b(_0x2b71ae);})['catch'](function(_0x14120b){logger[_0xa676('0x10')](_0xa676('0x18'),_0x14120b[_0xa676('0x12')],_0x252d3a);_0x2c22ce(_0x3dc270[_0xa676('0x10')](0x1f4,_0x14120b[_0xa676('0x12')]));});});};