ab65a627214f9a19557c18759180f099300b879a
[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 _0x6ba7=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','options','UpdateVoiceAgentReport','update','body','limit','catch','lodash','moment','randomstring','ioredis'];(function(_0x5b5027,_0x54ae4a){var _0x399a16=function(_0x233b0d){while(--_0x233b0d){_0x5b5027['push'](_0x5b5027['shift']());}};_0x399a16(++_0x54ae4a);}(_0x6ba7,0x146));var _0x76ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ba7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76ba('0x0'));var util=require('util');var moment=require(_0x76ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x76ba('0x2'));var fs=require('fs');var Redis=require(_0x76ba('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x76ba('0x4'));var logger=require('../../config/logger')(_0x76ba('0x5'));var config=require(_0x76ba('0x6'));var jayson=require(_0x76ba('0x7'));var client=jayson[_0x76ba('0x8')][_0x76ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x409562,_0x22342a,_0x52c0bd){return new BPromise(function(_0x1d916c,_0x2428db){return client['request'](_0x409562,_0x52c0bd)[_0x76ba('0xa')](function(_0x203312){logger[_0x76ba('0xb')](_0x76ba('0xc'),_0x22342a,'request\x20sent');logger[_0x76ba('0xd')](_0x76ba('0xe'),_0x22342a,_0x76ba('0xf'),JSON[_0x76ba('0x10')](_0x203312));if(_0x203312[_0x76ba('0x11')]){if(_0x203312['error'][_0x76ba('0x12')]===0x1f4){logger[_0x76ba('0x11')](_0x76ba('0xc'),_0x22342a,_0x203312[_0x76ba('0x11')]['message']);return _0x2428db(_0x203312[_0x76ba('0x11')]['message']);}logger[_0x76ba('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x22342a,_0x203312[_0x76ba('0x11')][_0x76ba('0x13')]);return _0x1d916c(_0x203312[_0x76ba('0x11')][_0x76ba('0x13')]);}else{logger[_0x76ba('0xb')](_0x76ba('0xc'),_0x22342a,_0x76ba('0xf'));_0x1d916c(_0x203312[_0x76ba('0x14')][_0x76ba('0x13')]);}})['catch'](function(_0x1a6c3b){logger['error'](_0x76ba('0xc'),_0x22342a,_0x1a6c3b);_0x2428db(_0x1a6c3b);});});}exports[_0x76ba('0x15')]=function(_0x36f8ee){var _0x2d95f9=this;return new Promise(function(_0xb369c1,_0x1e4066){return db[_0x76ba('0x16')][_0x76ba('0x17')](_0x36f8ee['body'],{'raw':_0x36f8ee[_0x76ba('0x18')]?_0x36f8ee[_0x76ba('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x76ba('0xa')](function(_0xeef85f){logger[_0x76ba('0xb')](_0x76ba('0x15'),_0x36f8ee);logger[_0x76ba('0xd')](_0x76ba('0x15'),_0x36f8ee,JSON[_0x76ba('0x10')](_0xeef85f));_0xb369c1(_0xeef85f);})['catch'](function(_0x53325e){logger[_0x76ba('0x11')](_0x76ba('0x15'),_0x53325e['message'],_0x36f8ee);_0x1e4066(_0x2d95f9[_0x76ba('0x11')](0x1f4,_0x53325e['message']));});});};exports[_0x76ba('0x19')]=function(_0x543db4){var _0x4034e9=this;return new Promise(function(_0x509d88,_0x229f01){return db[_0x76ba('0x16')][_0x76ba('0x1a')](_0x543db4[_0x76ba('0x1b')],{'raw':_0x543db4[_0x76ba('0x18')]?_0x543db4[_0x76ba('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x543db4[_0x76ba('0x18')]?_0x543db4['options']['where']||null:null,'attributes':_0x543db4[_0x76ba('0x18')]?_0x543db4['options']['attributes']||null:null,'limit':_0x543db4[_0x76ba('0x18')]?_0x543db4[_0x76ba('0x18')][_0x76ba('0x1c')]||null:null})[_0x76ba('0xa')](function(_0x47c25c){logger[_0x76ba('0xb')](_0x76ba('0x19'),_0x543db4);logger['debug'](_0x76ba('0x19'),_0x543db4,JSON[_0x76ba('0x10')](_0x47c25c));_0x509d88(_0x47c25c);})[_0x76ba('0x1d')](function(_0x3c530){logger[_0x76ba('0x11')](_0x76ba('0x19'),_0x3c530[_0x76ba('0x13')],_0x543db4);_0x229f01(_0x4034e9['error'](0x1f4,_0x3c530[_0x76ba('0x13')]));});});};