a7596d45e2dc0c5a9b33fa7ea1ccae2a1152fc08
[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 _0x8d3a=['error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','catch','update','body','attributes','UpdateVoiceAgentReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x56fbf6,_0x14fa32){var _0x33722b=function(_0x3b34c3){while(--_0x3b34c3){_0x56fbf6['push'](_0x56fbf6['shift']());}};_0x33722b(++_0x14fa32);}(_0x8d3a,0x1df));var _0xa8d3=function(_0x368c75,_0x386385){_0x368c75=_0x368c75-0x0;var _0x2d7a2b=_0x8d3a[_0x368c75];return _0x2d7a2b;};'use strict';var _=require(_0xa8d3('0x0'));var util=require(_0xa8d3('0x1'));var moment=require('moment');var BPromise=require(_0xa8d3('0x2'));var rs=require(_0xa8d3('0x3'));var fs=require('fs');var Redis=require(_0xa8d3('0x4'));var db=require(_0xa8d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8d3('0x6'))('rpc');var config=require(_0xa8d3('0x7'));var jayson=require(_0xa8d3('0x8'));var client=jayson[_0xa8d3('0x9')][_0xa8d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49904a,_0x4e2fa8,_0x54e948){return new BPromise(function(_0xbb0371,_0x2eeed7){return client['request'](_0x49904a,_0x54e948)[_0xa8d3('0xb')](function(_0x16d924){logger[_0xa8d3('0xc')](_0xa8d3('0xd'),_0x4e2fa8,_0xa8d3('0xe'));logger[_0xa8d3('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4e2fa8,_0xa8d3('0xe'),JSON[_0xa8d3('0x10')](_0x16d924));if(_0x16d924['error']){if(_0x16d924[_0xa8d3('0x11')][_0xa8d3('0x12')]===0x1f4){logger[_0xa8d3('0x11')](_0xa8d3('0xd'),_0x4e2fa8,_0x16d924['error'][_0xa8d3('0x13')]);return _0x2eeed7(_0x16d924[_0xa8d3('0x11')][_0xa8d3('0x13')]);}logger[_0xa8d3('0x11')](_0xa8d3('0xd'),_0x4e2fa8,_0x16d924[_0xa8d3('0x11')]['message']);return _0xbb0371(_0x16d924[_0xa8d3('0x11')]['message']);}else{logger['info'](_0xa8d3('0xd'),_0x4e2fa8,_0xa8d3('0xe'));_0xbb0371(_0x16d924[_0xa8d3('0x14')][_0xa8d3('0x13')]);}})['catch'](function(_0xa7b9a5){logger[_0xa8d3('0x11')](_0xa8d3('0xd'),_0x4e2fa8,_0xa7b9a5);_0x2eeed7(_0xa7b9a5);});});}exports[_0xa8d3('0x15')]=function(_0x20b500){var _0x1c4cae=this;return new Promise(function(_0x626b4c,_0xe951cf){return db[_0xa8d3('0x16')][_0xa8d3('0x17')](_0x20b500['body'],{'raw':_0x20b500[_0xa8d3('0x18')]?_0x20b500['options'][_0xa8d3('0x19')]===undefined?!![]:![]:!![]})[_0xa8d3('0xb')](function(_0x5c452c){logger[_0xa8d3('0xc')]('CreateVoiceAgentReport',_0x20b500);logger[_0xa8d3('0xf')](_0xa8d3('0x15'),_0x20b500,JSON[_0xa8d3('0x10')](_0x5c452c));_0x626b4c(_0x5c452c);})[_0xa8d3('0x1a')](function(_0x2a0bb5){logger[_0xa8d3('0x11')]('CreateVoiceAgentReport',_0x2a0bb5['message'],_0x20b500);_0xe951cf(_0x1c4cae[_0xa8d3('0x11')](0x1f4,_0x2a0bb5['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x353ff9){var _0x37a9a1=this;return new Promise(function(_0x2fc25c,_0x2c1b7f){return db[_0xa8d3('0x16')][_0xa8d3('0x1b')](_0x353ff9[_0xa8d3('0x1c')],{'raw':_0x353ff9[_0xa8d3('0x18')]?_0x353ff9[_0xa8d3('0x18')][_0xa8d3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x353ff9[_0xa8d3('0x18')]?_0x353ff9['options']['where']||null:null,'attributes':_0x353ff9[_0xa8d3('0x18')]?_0x353ff9[_0xa8d3('0x18')][_0xa8d3('0x1d')]||null:null,'limit':_0x353ff9[_0xa8d3('0x18')]?_0x353ff9[_0xa8d3('0x18')]['limit']||null:null})[_0xa8d3('0xb')](function(_0x2e09a1){logger[_0xa8d3('0xc')](_0xa8d3('0x1e'),_0x353ff9);logger[_0xa8d3('0xf')](_0xa8d3('0x1e'),_0x353ff9,JSON[_0xa8d3('0x10')](_0x2e09a1));_0x2fc25c(_0x2e09a1);})[_0xa8d3('0x1a')](function(_0x2725e1){logger['error'](_0xa8d3('0x1e'),_0x2725e1[_0xa8d3('0x13')],_0x353ff9);_0x2c1b7f(_0x37a9a1['error'](0x1f4,_0x2725e1[_0xa8d3('0x13')]));});});};