29a29f75ab5674231007fad920551dd083437ed1
[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 _0x5bca=['options','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body'];(function(_0x1ed21f,_0x51b067){var _0x3316d4=function(_0x23a48c){while(--_0x23a48c){_0x1ed21f['push'](_0x1ed21f['shift']());}};_0x3316d4(++_0x51b067);}(_0x5bca,0xd8));var _0xa5bc=function(_0x253d2b,_0x49a0fb){_0x253d2b=_0x253d2b-0x0;var _0x3ce8bd=_0x5bca[_0x253d2b];return _0x3ce8bd;};'use strict';var _=require(_0xa5bc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa5bc('0x1'));var rs=require(_0xa5bc('0x2'));var fs=require('fs');var Redis=require(_0xa5bc('0x3'));var db=require(_0xa5bc('0x4'))['db'];var utils=require(_0xa5bc('0x5'));var logger=require(_0xa5bc('0x6'))('rpc');var config=require(_0xa5bc('0x7'));var jayson=require(_0xa5bc('0x8'));var client=jayson['client'][_0xa5bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa9a6c4,_0x2ca338,_0x2aff17){return new BPromise(function(_0x429cbf,_0x112e02){return client['request'](_0xa9a6c4,_0x2aff17)[_0xa5bc('0xa')](function(_0x1d1482){logger['info'](_0xa5bc('0xb'),_0x2ca338,_0xa5bc('0xc'));logger[_0xa5bc('0xd')](_0xa5bc('0xe'),_0x2ca338,'request\x20sent',JSON[_0xa5bc('0xf')](_0x1d1482));if(_0x1d1482[_0xa5bc('0x10')]){if(_0x1d1482[_0xa5bc('0x10')]['code']===0x1f4){logger[_0xa5bc('0x10')](_0xa5bc('0xb'),_0x2ca338,_0x1d1482[_0xa5bc('0x10')][_0xa5bc('0x11')]);return _0x112e02(_0x1d1482['error'][_0xa5bc('0x11')]);}logger[_0xa5bc('0x10')](_0xa5bc('0xb'),_0x2ca338,_0x1d1482[_0xa5bc('0x10')][_0xa5bc('0x11')]);return _0x429cbf(_0x1d1482[_0xa5bc('0x10')][_0xa5bc('0x11')]);}else{logger[_0xa5bc('0x12')](_0xa5bc('0xb'),_0x2ca338,_0xa5bc('0xc'));_0x429cbf(_0x1d1482['result'][_0xa5bc('0x11')]);}})[_0xa5bc('0x13')](function(_0x2986dc){logger[_0xa5bc('0x10')](_0xa5bc('0xb'),_0x2ca338,_0x2986dc);_0x112e02(_0x2986dc);});});}exports[_0xa5bc('0x14')]=function(_0x1de44d){var _0x5e990e=this;return new Promise(function(_0x3586ea,_0x1060cd){return db[_0xa5bc('0x15')][_0xa5bc('0x16')](_0x1de44d[_0xa5bc('0x17')],{'raw':_0x1de44d[_0xa5bc('0x18')]?_0x1de44d['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x198ab9){logger[_0xa5bc('0x12')](_0xa5bc('0x14'),_0x1de44d);logger[_0xa5bc('0xd')](_0xa5bc('0x14'),_0x1de44d,JSON[_0xa5bc('0xf')](_0x198ab9));_0x3586ea(_0x198ab9);})['catch'](function(_0x3bf723){logger[_0xa5bc('0x10')]('CreateVoiceAgentReport',_0x3bf723[_0xa5bc('0x11')],_0x1de44d);_0x1060cd(_0x5e990e[_0xa5bc('0x10')](0x1f4,_0x3bf723[_0xa5bc('0x11')]));});});};exports[_0xa5bc('0x19')]=function(_0x4d3bd2){var _0x507e9e=this;return new Promise(function(_0x5f49fb,_0x43e5bb){return db[_0xa5bc('0x15')][_0xa5bc('0x1a')](_0x4d3bd2['body'],{'raw':_0x4d3bd2[_0xa5bc('0x18')]?_0x4d3bd2[_0xa5bc('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d3bd2[_0xa5bc('0x18')]?_0x4d3bd2[_0xa5bc('0x18')][_0xa5bc('0x1b')]||null:null,'attributes':_0x4d3bd2[_0xa5bc('0x18')]?_0x4d3bd2['options'][_0xa5bc('0x1c')]||null:null,'limit':_0x4d3bd2[_0xa5bc('0x18')]?_0x4d3bd2[_0xa5bc('0x18')][_0xa5bc('0x1d')]||null:null})[_0xa5bc('0xa')](function(_0x1fe49d){logger[_0xa5bc('0x12')](_0xa5bc('0x19'),_0x4d3bd2);logger['debug'](_0xa5bc('0x19'),_0x4d3bd2,JSON['stringify'](_0x1fe49d));_0x5f49fb(_0x1fe49d);})[_0xa5bc('0x13')](function(_0x453206){logger[_0xa5bc('0x10')]('UpdateVoiceAgentReport',_0x453206[_0xa5bc('0x11')],_0x4d3bd2);_0x43e5bb(_0x507e9e[_0xa5bc('0x10')](0x1f4,_0x453206[_0xa5bc('0x11')]));});});};