c7518eba8f77fd7758f42ced032ff0c5851edd7d
[motion2.git] / server / api / voiceAgentReport / voiceAgentReport.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 _0xfa06=['then','UpdateVoiceAgentReport','update','where','limit','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceAgentReport,\x20%s,\x20%s','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw'];(function(_0x2b6e3e,_0x2987cc){var _0x3b7828=function(_0x2c217d){while(--_0x2c217d){_0x2b6e3e['push'](_0x2b6e3e['shift']());}};_0x3b7828(++_0x2987cc);}(_0xfa06,0x198));var _0x6fa0=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xfa06[_0xa6cc5c];return _0x44803d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6fa0('0x0'));var BPromise=require(_0x6fa0('0x1'));var rs=require(_0x6fa0('0x2'));var fs=require('fs');var Redis=require(_0x6fa0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fa0('0x4'));var logger=require(_0x6fa0('0x5'))(_0x6fa0('0x6'));var config=require(_0x6fa0('0x7'));var jayson=require(_0x6fa0('0x8'));var client=jayson['client'][_0x6fa0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27f0fe,_0x391ef2,_0x2155bb){return new BPromise(function(_0x25ceea,_0x181c26){return client[_0x6fa0('0xa')](_0x27f0fe,_0x2155bb)['then'](function(_0x5a125){logger[_0x6fa0('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x391ef2,_0x6fa0('0xc'));logger[_0x6fa0('0xd')](_0x6fa0('0xe'),_0x391ef2,'request\x20sent',JSON[_0x6fa0('0xf')](_0x5a125));if(_0x5a125[_0x6fa0('0x10')]){if(_0x5a125[_0x6fa0('0x10')]['code']===0x1f4){logger[_0x6fa0('0x10')](_0x6fa0('0x11'),_0x391ef2,_0x5a125[_0x6fa0('0x10')][_0x6fa0('0x12')]);return _0x181c26(_0x5a125['error'][_0x6fa0('0x12')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x391ef2,_0x5a125[_0x6fa0('0x10')]['message']);return _0x25ceea(_0x5a125[_0x6fa0('0x10')]['message']);}else{logger[_0x6fa0('0xb')](_0x6fa0('0x11'),_0x391ef2,_0x6fa0('0xc'));_0x25ceea(_0x5a125['result'][_0x6fa0('0x12')]);}})[_0x6fa0('0x13')](function(_0x367308){logger[_0x6fa0('0x10')](_0x6fa0('0x11'),_0x391ef2,_0x367308);_0x181c26(_0x367308);});});}exports[_0x6fa0('0x14')]=function(_0x3e5961){var _0x3f52f6=this;return new Promise(function(_0x4877af,_0x58453f){return db[_0x6fa0('0x15')][_0x6fa0('0x16')](_0x3e5961[_0x6fa0('0x17')],{'raw':_0x3e5961[_0x6fa0('0x18')]?_0x3e5961[_0x6fa0('0x18')][_0x6fa0('0x19')]===undefined?!![]:![]:!![]})[_0x6fa0('0x1a')](function(_0x5b4e8a){logger[_0x6fa0('0xb')](_0x6fa0('0x14'),_0x3e5961);logger['debug'](_0x6fa0('0x14'),_0x3e5961,JSON[_0x6fa0('0xf')](_0x5b4e8a));_0x4877af(_0x5b4e8a);})['catch'](function(_0x38fefc){logger[_0x6fa0('0x10')]('CreateVoiceAgentReport',_0x38fefc[_0x6fa0('0x12')],_0x3e5961);_0x58453f(_0x3f52f6[_0x6fa0('0x10')](0x1f4,_0x38fefc[_0x6fa0('0x12')]));});});};exports[_0x6fa0('0x1b')]=function(_0x4bae26){var _0x1abe03=this;return new Promise(function(_0x154822,_0x2fbaad){return db[_0x6fa0('0x15')][_0x6fa0('0x1c')](_0x4bae26[_0x6fa0('0x17')],{'raw':_0x4bae26[_0x6fa0('0x18')]?_0x4bae26[_0x6fa0('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bae26['options']?_0x4bae26[_0x6fa0('0x18')][_0x6fa0('0x1d')]||null:null,'attributes':_0x4bae26['options']?_0x4bae26[_0x6fa0('0x18')]['attributes']||null:null,'limit':_0x4bae26[_0x6fa0('0x18')]?_0x4bae26[_0x6fa0('0x18')][_0x6fa0('0x1e')]||null:null})[_0x6fa0('0x1a')](function(_0x36dfb0){logger['info']('UpdateVoiceAgentReport',_0x4bae26);logger['debug'](_0x6fa0('0x1b'),_0x4bae26,JSON[_0x6fa0('0xf')](_0x36dfb0));_0x154822(_0x36dfb0);})['catch'](function(_0x3386ea){logger[_0x6fa0('0x10')](_0x6fa0('0x1b'),_0x3386ea['message'],_0x4bae26);_0x2fbaad(_0x1abe03[_0x6fa0('0x10')](0x1f4,_0x3386ea[_0x6fa0('0x12')]));});});};