742ad80a9534cf2510654d0f8f304f4bb74d4cf2
[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 _0xa6b3=['client','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceAgentReport,\x20%s,\x20%s','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','stringify','UpdateVoiceAgentReport','limit','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4e10ef,_0x43bb57){var _0x3528ef=function(_0x40cbf4){while(--_0x40cbf4){_0x4e10ef['push'](_0x4e10ef['shift']());}};_0x3528ef(++_0x43bb57);}(_0xa6b3,0x165));var _0x3a6b=function(_0x33e48f,_0x47ef69){_0x33e48f=_0x33e48f-0x0;var _0x591d05=_0xa6b3[_0x33e48f];return _0x591d05;};'use strict';var _=require('lodash');var util=require(_0x3a6b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3a6b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a6b('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a6b('0x3'))(_0x3a6b('0x4'));var config=require(_0x3a6b('0x5'));var jayson=require(_0x3a6b('0x6'));var client=jayson[_0x3a6b('0x7')][_0x3a6b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bef23,_0x1cf7b7,_0x5082ca){return new BPromise(function(_0xa97ad5,_0x33fdff){return client[_0x3a6b('0x9')](_0x3bef23,_0x5082ca)[_0x3a6b('0xa')](function(_0x30d4f4){logger[_0x3a6b('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x1cf7b7,_0x3a6b('0xc'));logger[_0x3a6b('0xd')](_0x3a6b('0xe'),_0x1cf7b7,_0x3a6b('0xc'),JSON['stringify'](_0x30d4f4));if(_0x30d4f4[_0x3a6b('0xf')]){if(_0x30d4f4[_0x3a6b('0xf')][_0x3a6b('0x10')]===0x1f4){logger[_0x3a6b('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x1cf7b7,_0x30d4f4[_0x3a6b('0xf')][_0x3a6b('0x11')]);return _0x33fdff(_0x30d4f4[_0x3a6b('0xf')]['message']);}logger[_0x3a6b('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x1cf7b7,_0x30d4f4[_0x3a6b('0xf')][_0x3a6b('0x11')]);return _0xa97ad5(_0x30d4f4['error'][_0x3a6b('0x11')]);}else{logger[_0x3a6b('0xb')](_0x3a6b('0x12'),_0x1cf7b7,_0x3a6b('0xc'));_0xa97ad5(_0x30d4f4['result'][_0x3a6b('0x11')]);}})[_0x3a6b('0x13')](function(_0x4d8756){logger['error'](_0x3a6b('0x12'),_0x1cf7b7,_0x4d8756);_0x33fdff(_0x4d8756);});});}exports[_0x3a6b('0x14')]=function(_0x4d0ae8){var _0x3120a6=this;return new Promise(function(_0x194117,_0x275efa){return db[_0x3a6b('0x15')][_0x3a6b('0x16')](_0x4d0ae8[_0x3a6b('0x17')],{'raw':_0x4d0ae8[_0x3a6b('0x18')]?_0x4d0ae8[_0x3a6b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x3a6b('0xa')](function(_0x550ee3){logger[_0x3a6b('0xb')](_0x3a6b('0x14'),_0x4d0ae8);logger[_0x3a6b('0xd')](_0x3a6b('0x14'),_0x4d0ae8,JSON[_0x3a6b('0x19')](_0x550ee3));_0x194117(_0x550ee3);})[_0x3a6b('0x13')](function(_0x580c01){logger[_0x3a6b('0xf')](_0x3a6b('0x14'),_0x580c01['message'],_0x4d0ae8);_0x275efa(_0x3120a6['error'](0x1f4,_0x580c01[_0x3a6b('0x11')]));});});};exports[_0x3a6b('0x1a')]=function(_0x35f726){var _0x37f52d=this;return new Promise(function(_0xa1de39,_0x1e25b3){return db['VoiceAgentReport']['update'](_0x35f726[_0x3a6b('0x17')],{'raw':_0x35f726['options']?_0x35f726[_0x3a6b('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35f726[_0x3a6b('0x18')]?_0x35f726[_0x3a6b('0x18')]['where']||null:null,'attributes':_0x35f726['options']?_0x35f726[_0x3a6b('0x18')]['attributes']||null:null,'limit':_0x35f726[_0x3a6b('0x18')]?_0x35f726[_0x3a6b('0x18')][_0x3a6b('0x1b')]||null:null})['then'](function(_0x29485d){logger[_0x3a6b('0xb')]('UpdateVoiceAgentReport',_0x35f726);logger[_0x3a6b('0xd')](_0x3a6b('0x1a'),_0x35f726,JSON[_0x3a6b('0x19')](_0x29485d));_0xa1de39(_0x29485d);})[_0x3a6b('0x13')](function(_0x545ede){logger['error']('UpdateVoiceAgentReport',_0x545ede['message'],_0x35f726);_0x1e25b3(_0x37f52d[_0x3a6b('0xf')](0x1f4,_0x545ede[_0x3a6b('0x11')]));});});};