Built motion from commit da617fac.|2.6.6
[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 _0x56d7=['options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview'];(function(_0x59571c,_0x1cc576){var _0x38a48c=function(_0x3fe93f){while(--_0x3fe93f){_0x59571c['push'](_0x59571c['shift']());}};_0x38a48c(++_0x1cc576);}(_0x56d7,0xb6));var _0x756d=function(_0x28c752,_0x238454){_0x28c752=_0x28c752-0x0;var _0x30cd6c=_0x56d7[_0x28c752];return _0x30cd6c;};'use strict';var _=require(_0x756d('0x0'));var util=require(_0x756d('0x1'));var moment=require(_0x756d('0x2'));var BPromise=require(_0x756d('0x3'));var rs=require(_0x756d('0x4'));var fs=require('fs');var Redis=require(_0x756d('0x5'));var db=require(_0x756d('0x6'))['db'];var utils=require(_0x756d('0x7'));var logger=require(_0x756d('0x8'))(_0x756d('0x9'));var config=require(_0x756d('0xa'));var jayson=require(_0x756d('0xb'));var client=jayson[_0x756d('0xc')][_0x756d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x30b4ed,_0x5ab4cb,_0x2181b7){return new BPromise(function(_0x2fcce2,_0x272f04){return client['request'](_0x30b4ed,_0x2181b7)[_0x756d('0xe')](function(_0x261e68){logger[_0x756d('0xf')](_0x756d('0x10'),_0x5ab4cb,_0x756d('0x11'));logger[_0x756d('0x12')](_0x756d('0x13'),_0x5ab4cb,_0x756d('0x11'),JSON[_0x756d('0x14')](_0x261e68));if(_0x261e68['error']){if(_0x261e68[_0x756d('0x15')][_0x756d('0x16')]===0x1f4){logger['error'](_0x756d('0x10'),_0x5ab4cb,_0x261e68[_0x756d('0x15')][_0x756d('0x17')]);return _0x272f04(_0x261e68[_0x756d('0x15')][_0x756d('0x17')]);}logger[_0x756d('0x15')](_0x756d('0x10'),_0x5ab4cb,_0x261e68[_0x756d('0x15')][_0x756d('0x17')]);return _0x2fcce2(_0x261e68[_0x756d('0x15')]['message']);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x5ab4cb,_0x756d('0x11'));_0x2fcce2(_0x261e68[_0x756d('0x18')]['message']);}})[_0x756d('0x19')](function(_0x1771e2){logger['error'](_0x756d('0x10'),_0x5ab4cb,_0x1771e2);_0x272f04(_0x1771e2);});});}exports[_0x756d('0x1a')]=function(_0x4d7b39){var _0x5ed7f8=this;return new Promise(function(_0x320601,_0x3a0cd1){return db[_0x756d('0x1b')]['create'](_0x4d7b39['body'],{'raw':_0x4d7b39['options']?_0x4d7b39[_0x756d('0x1c')][_0x756d('0x1d')]===undefined?!![]:![]:!![]})[_0x756d('0xe')](function(_0x3540af){logger[_0x756d('0xf')](_0x756d('0x1a'),_0x4d7b39);logger['debug'](_0x756d('0x1a'),_0x4d7b39,JSON[_0x756d('0x14')](_0x3540af));_0x320601(_0x3540af);})[_0x756d('0x19')](function(_0x5f116a){logger[_0x756d('0x15')](_0x756d('0x1a'),_0x5f116a[_0x756d('0x17')],_0x4d7b39);_0x3a0cd1(_0x5ed7f8[_0x756d('0x15')](0x1f4,_0x5f116a[_0x756d('0x17')]));});});};