aa705372cfbc62685c864997a7d785634ecdbd51
[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 _0x8486=['UpdateVoiceAgentReport','update','raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options'];(function(_0xafe5f6,_0x16d5bb){var _0x2cf095=function(_0x23f1d1){while(--_0x23f1d1){_0xafe5f6['push'](_0xafe5f6['shift']());}};_0x2cf095(++_0x16d5bb);}(_0x8486,0xaf));var _0x6848=function(_0x12223f,_0x21dffd){_0x12223f=_0x12223f-0x0;var _0x53c49a=_0x8486[_0x12223f];return _0x53c49a;};'use strict';var _=require(_0x6848('0x0'));var util=require(_0x6848('0x1'));var moment=require(_0x6848('0x2'));var BPromise=require(_0x6848('0x3'));var rs=require(_0x6848('0x4'));var fs=require('fs');var Redis=require(_0x6848('0x5'));var db=require(_0x6848('0x6'))['db'];var utils=require(_0x6848('0x7'));var logger=require(_0x6848('0x8'))(_0x6848('0x9'));var config=require('../../config/environment');var jayson=require(_0x6848('0xa'));var client=jayson[_0x6848('0xb')][_0x6848('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24cabc,_0x24f3ca,_0x5d001e){return new BPromise(function(_0x2d8405,_0xfb5809){return client['request'](_0x24cabc,_0x5d001e)[_0x6848('0xd')](function(_0x48d6b7){logger[_0x6848('0xe')](_0x6848('0xf'),_0x24f3ca,'request\x20sent');logger[_0x6848('0x10')](_0x6848('0x11'),_0x24f3ca,_0x6848('0x12'),JSON[_0x6848('0x13')](_0x48d6b7));if(_0x48d6b7['error']){if(_0x48d6b7['error'][_0x6848('0x14')]===0x1f4){logger[_0x6848('0x15')](_0x6848('0xf'),_0x24f3ca,_0x48d6b7['error'][_0x6848('0x16')]);return _0xfb5809(_0x48d6b7[_0x6848('0x15')][_0x6848('0x16')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x24f3ca,_0x48d6b7[_0x6848('0x15')]['message']);return _0x2d8405(_0x48d6b7[_0x6848('0x15')]['message']);}else{logger[_0x6848('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x24f3ca,_0x6848('0x12'));_0x2d8405(_0x48d6b7['result']['message']);}})[_0x6848('0x17')](function(_0x179284){logger[_0x6848('0x15')](_0x6848('0xf'),_0x24f3ca,_0x179284);_0xfb5809(_0x179284);});});}exports[_0x6848('0x18')]=function(_0x3ca362){var _0x7db693=this;return new Promise(function(_0x31c795,_0x3cd49b){return db[_0x6848('0x19')][_0x6848('0x1a')](_0x3ca362[_0x6848('0x1b')],{'raw':_0x3ca362[_0x6848('0x1c')]?_0x3ca362[_0x6848('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x14c8b1){logger[_0x6848('0xe')](_0x6848('0x18'),_0x3ca362);logger[_0x6848('0x10')](_0x6848('0x18'),_0x3ca362,JSON[_0x6848('0x13')](_0x14c8b1));_0x31c795(_0x14c8b1);})[_0x6848('0x17')](function(_0x46c561){logger[_0x6848('0x15')](_0x6848('0x18'),_0x46c561['message'],_0x3ca362);_0x3cd49b(_0x7db693[_0x6848('0x15')](0x1f4,_0x46c561[_0x6848('0x16')]));});});};exports[_0x6848('0x1d')]=function(_0x519603){var _0x17fd4f=this;return new Promise(function(_0x18ade7,_0xed0871){return db[_0x6848('0x19')][_0x6848('0x1e')](_0x519603[_0x6848('0x1b')],{'raw':_0x519603['options']?_0x519603[_0x6848('0x1c')][_0x6848('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x519603[_0x6848('0x1c')]?_0x519603[_0x6848('0x1c')]['where']||null:null,'attributes':_0x519603[_0x6848('0x1c')]?_0x519603[_0x6848('0x1c')][_0x6848('0x20')]||null:null,'limit':_0x519603[_0x6848('0x1c')]?_0x519603[_0x6848('0x1c')][_0x6848('0x21')]||null:null})[_0x6848('0xd')](function(_0x35aab4){logger[_0x6848('0xe')](_0x6848('0x1d'),_0x519603);logger[_0x6848('0x10')](_0x6848('0x1d'),_0x519603,JSON[_0x6848('0x13')](_0x35aab4));_0x18ade7(_0x35aab4);})['catch'](function(_0x4ecc11){logger[_0x6848('0x15')](_0x6848('0x1d'),_0x4ecc11['message'],_0x519603);_0xed0871(_0x17fd4f[_0x6848('0x15')](0x1f4,_0x4ecc11[_0x6848('0x16')]));});});};