Built motion from commit 4d4d9a88.|2.6.26
[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 _0xa468=['rpc','../../config/environment','jayson/promise','then','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','catch','CreateReportAgentPreview','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x305fbd,_0x1ac19e){var _0xd4469=function(_0x4172ec){while(--_0x4172ec){_0x305fbd['push'](_0x305fbd['shift']());}};_0xd4469(++_0x1ac19e);}(_0xa468,0x1d3));var _0x8a46=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xa468[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x8a46('0x0'));var util=require(_0x8a46('0x1'));var moment=require(_0x8a46('0x2'));var BPromise=require(_0x8a46('0x3'));var rs=require(_0x8a46('0x4'));var fs=require('fs');var Redis=require(_0x8a46('0x5'));var db=require(_0x8a46('0x6'))['db'];var utils=require(_0x8a46('0x7'));var logger=require(_0x8a46('0x8'))(_0x8a46('0x9'));var config=require(_0x8a46('0xa'));var jayson=require(_0x8a46('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4520ce,_0xcbc898,_0x454563){return new BPromise(function(_0x334dfa,_0x45f3ac){return client['request'](_0x4520ce,_0x454563)[_0x8a46('0xc')](function(_0x2ebdb4){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0xcbc898,'request\x20sent');logger['debug'](_0x8a46('0xd'),_0xcbc898,_0x8a46('0xe'),JSON[_0x8a46('0xf')](_0x2ebdb4));if(_0x2ebdb4[_0x8a46('0x10')]){if(_0x2ebdb4['error'][_0x8a46('0x11')]===0x1f4){logger['error'](_0x8a46('0x12'),_0xcbc898,_0x2ebdb4['error']['message']);return _0x45f3ac(_0x2ebdb4[_0x8a46('0x10')][_0x8a46('0x13')]);}logger[_0x8a46('0x10')](_0x8a46('0x12'),_0xcbc898,_0x2ebdb4['error'][_0x8a46('0x13')]);return _0x334dfa(_0x2ebdb4['error'][_0x8a46('0x13')]);}else{logger[_0x8a46('0x14')](_0x8a46('0x12'),_0xcbc898,_0x8a46('0xe'));_0x334dfa(_0x2ebdb4['result'][_0x8a46('0x13')]);}})[_0x8a46('0x15')](function(_0x437394){logger['error'](_0x8a46('0x12'),_0xcbc898,_0x437394);_0x45f3ac(_0x437394);});});}exports[_0x8a46('0x16')]=function(_0x507c78){var _0x3f0f39=this;return new Promise(function(_0x2530b7,_0x4b3bb2){return db['ReportAgentPreview'][_0x8a46('0x17')](_0x507c78[_0x8a46('0x18')],{'raw':_0x507c78['options']?_0x507c78[_0x8a46('0x19')][_0x8a46('0x1a')]===undefined?!![]:![]:!![]})[_0x8a46('0xc')](function(_0x421d65){logger[_0x8a46('0x14')]('CreateReportAgentPreview',_0x507c78);logger[_0x8a46('0x1b')](_0x8a46('0x16'),_0x507c78,JSON[_0x8a46('0xf')](_0x421d65));_0x2530b7(_0x421d65);})[_0x8a46('0x15')](function(_0x3a9c80){logger['error']('CreateReportAgentPreview',_0x3a9c80['message'],_0x507c78);_0x4b3bb2(_0x3f0f39[_0x8a46('0x10')](0x1f4,_0x3a9c80[_0x8a46('0x13')]));});});};