45f8a190e9e8d9167c2acdc761ba054dee378f05
[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 _0x25cf=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','then','catch','UpdateVoiceAgentReport','update','where','attributes'];(function(_0x2c3458,_0x1f7efd){var _0x3f7e02=function(_0x261040){while(--_0x261040){_0x2c3458['push'](_0x2c3458['shift']());}};_0x3f7e02(++_0x1f7efd);}(_0x25cf,0x140));var _0xf25c=function(_0x196ce1,_0x46e836){_0x196ce1=_0x196ce1-0x0;var _0x360a64=_0x25cf[_0x196ce1];return _0x360a64;};'use strict';var _=require(_0xf25c('0x0'));var util=require(_0xf25c('0x1'));var moment=require(_0xf25c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf25c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf25c('0x4'));var logger=require(_0xf25c('0x5'))(_0xf25c('0x6'));var config=require('../../config/environment');var jayson=require(_0xf25c('0x7'));var client=jayson[_0xf25c('0x8')][_0xf25c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45f300,_0x509d34,_0x42065a){return new BPromise(function(_0x159056,_0x4ad392){return client[_0xf25c('0xa')](_0x45f300,_0x42065a)['then'](function(_0x5e7ba2){logger[_0xf25c('0xb')](_0xf25c('0xc'),_0x509d34,_0xf25c('0xd'));logger[_0xf25c('0xe')](_0xf25c('0xf'),_0x509d34,_0xf25c('0xd'),JSON[_0xf25c('0x10')](_0x5e7ba2));if(_0x5e7ba2[_0xf25c('0x11')]){if(_0x5e7ba2['error'][_0xf25c('0x12')]===0x1f4){logger[_0xf25c('0x11')](_0xf25c('0xc'),_0x509d34,_0x5e7ba2['error'][_0xf25c('0x13')]);return _0x4ad392(_0x5e7ba2[_0xf25c('0x11')]['message']);}logger[_0xf25c('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x509d34,_0x5e7ba2[_0xf25c('0x11')][_0xf25c('0x13')]);return _0x159056(_0x5e7ba2[_0xf25c('0x11')][_0xf25c('0x13')]);}else{logger[_0xf25c('0xb')](_0xf25c('0xc'),_0x509d34,_0xf25c('0xd'));_0x159056(_0x5e7ba2[_0xf25c('0x14')][_0xf25c('0x13')]);}})['catch'](function(_0x537af0){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x509d34,_0x537af0);_0x4ad392(_0x537af0);});});}exports[_0xf25c('0x15')]=function(_0x57040a){var _0x4e1a98=this;return new Promise(function(_0x17bf19,_0x1d0804){return db[_0xf25c('0x16')][_0xf25c('0x17')](_0x57040a['body'],{'raw':_0x57040a[_0xf25c('0x18')]?_0x57040a[_0xf25c('0x18')][_0xf25c('0x19')]===undefined?!![]:![]:!![]})[_0xf25c('0x1a')](function(_0x5a396f){logger[_0xf25c('0xb')](_0xf25c('0x15'),_0x57040a);logger[_0xf25c('0xe')](_0xf25c('0x15'),_0x57040a,JSON[_0xf25c('0x10')](_0x5a396f));_0x17bf19(_0x5a396f);})[_0xf25c('0x1b')](function(_0x1f8f82){logger[_0xf25c('0x11')](_0xf25c('0x15'),_0x1f8f82[_0xf25c('0x13')],_0x57040a);_0x1d0804(_0x4e1a98[_0xf25c('0x11')](0x1f4,_0x1f8f82[_0xf25c('0x13')]));});});};exports[_0xf25c('0x1c')]=function(_0x427b76){var _0x57ac28=this;return new Promise(function(_0xd09dda,_0x34cd74){return db['VoiceAgentReport'][_0xf25c('0x1d')](_0x427b76['body'],{'raw':_0x427b76[_0xf25c('0x18')]?_0x427b76[_0xf25c('0x18')][_0xf25c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x427b76[_0xf25c('0x18')]?_0x427b76[_0xf25c('0x18')][_0xf25c('0x1e')]||null:null,'attributes':_0x427b76[_0xf25c('0x18')]?_0x427b76[_0xf25c('0x18')][_0xf25c('0x1f')]||null:null,'limit':_0x427b76[_0xf25c('0x18')]?_0x427b76[_0xf25c('0x18')]['limit']||null:null})[_0xf25c('0x1a')](function(_0x3c22a0){logger['info']('UpdateVoiceAgentReport',_0x427b76);logger['debug'](_0xf25c('0x1c'),_0x427b76,JSON['stringify'](_0x3c22a0));_0xd09dda(_0x3c22a0);})[_0xf25c('0x1b')](function(_0x241e9c){logger[_0xf25c('0x11')](_0xf25c('0x1c'),_0x241e9c[_0xf25c('0x13')],_0x427b76);_0x34cd74(_0x57ac28['error'](0x1f4,_0x241e9c['message']));});});};