Built motion from commit d69f4380.|2.6.29
[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 _0xfc00=['raw','then','stringify','update','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','VoiceAgentReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options'];(function(_0x5f51c4,_0x204c1a){var _0x5c0a8d=function(_0x2c3207){while(--_0x2c3207){_0x5f51c4['push'](_0x5f51c4['shift']());}};_0x5c0a8d(++_0x204c1a);}(_0xfc00,0x167));var _0x0fc0=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0xfc00[_0x3c59fc];return _0x2b78d4;};'use strict';var _=require(_0x0fc0('0x0'));var util=require(_0x0fc0('0x1'));var moment=require(_0x0fc0('0x2'));var BPromise=require('bluebird');var rs=require(_0x0fc0('0x3'));var fs=require('fs');var Redis=require(_0x0fc0('0x4'));var db=require(_0x0fc0('0x5'))['db'];var utils=require(_0x0fc0('0x6'));var logger=require(_0x0fc0('0x7'))(_0x0fc0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0fc0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2692de,_0x455638,_0x1fd412){return new BPromise(function(_0x3fd068,_0x4a3285){return client[_0x0fc0('0xa')](_0x2692de,_0x1fd412)['then'](function(_0x1e33a7){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x455638,_0x0fc0('0xb'));logger[_0x0fc0('0xc')](_0x0fc0('0xd'),_0x455638,_0x0fc0('0xb'),JSON['stringify'](_0x1e33a7));if(_0x1e33a7[_0x0fc0('0xe')]){if(_0x1e33a7[_0x0fc0('0xe')][_0x0fc0('0xf')]===0x1f4){logger[_0x0fc0('0xe')](_0x0fc0('0x10'),_0x455638,_0x1e33a7[_0x0fc0('0xe')]['message']);return _0x4a3285(_0x1e33a7[_0x0fc0('0xe')][_0x0fc0('0x11')]);}logger[_0x0fc0('0xe')](_0x0fc0('0x10'),_0x455638,_0x1e33a7[_0x0fc0('0xe')][_0x0fc0('0x11')]);return _0x3fd068(_0x1e33a7[_0x0fc0('0xe')]['message']);}else{logger[_0x0fc0('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x455638,'request\x20sent');_0x3fd068(_0x1e33a7[_0x0fc0('0x13')][_0x0fc0('0x11')]);}})[_0x0fc0('0x14')](function(_0x4cf92f){logger[_0x0fc0('0xe')](_0x0fc0('0x10'),_0x455638,_0x4cf92f);_0x4a3285(_0x4cf92f);});});}exports[_0x0fc0('0x15')]=function(_0x5e29f9){var _0x301ce5=this;return new Promise(function(_0x4f70aa,_0x4e1fcf){return db[_0x0fc0('0x16')][_0x0fc0('0x17')](_0x5e29f9['body'],{'raw':_0x5e29f9[_0x0fc0('0x18')]?_0x5e29f9[_0x0fc0('0x18')][_0x0fc0('0x19')]===undefined?!![]:![]:!![]})[_0x0fc0('0x1a')](function(_0x202ab0){logger[_0x0fc0('0x12')](_0x0fc0('0x15'),_0x5e29f9);logger[_0x0fc0('0xc')](_0x0fc0('0x15'),_0x5e29f9,JSON[_0x0fc0('0x1b')](_0x202ab0));_0x4f70aa(_0x202ab0);})[_0x0fc0('0x14')](function(_0x8e8556){logger['error'](_0x0fc0('0x15'),_0x8e8556[_0x0fc0('0x11')],_0x5e29f9);_0x4e1fcf(_0x301ce5[_0x0fc0('0xe')](0x1f4,_0x8e8556['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x5d0de6){var _0x39f918=this;return new Promise(function(_0x1acace,_0x12e23e){return db['VoiceAgentReport'][_0x0fc0('0x1c')](_0x5d0de6['body'],{'raw':_0x5d0de6[_0x0fc0('0x18')]?_0x5d0de6[_0x0fc0('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d0de6[_0x0fc0('0x18')]?_0x5d0de6[_0x0fc0('0x18')]['where']||null:null,'attributes':_0x5d0de6[_0x0fc0('0x18')]?_0x5d0de6['options'][_0x0fc0('0x1d')]||null:null,'limit':_0x5d0de6[_0x0fc0('0x18')]?_0x5d0de6['options'][_0x0fc0('0x1e')]||null:null})[_0x0fc0('0x1a')](function(_0x435f77){logger[_0x0fc0('0x12')](_0x0fc0('0x1f'),_0x5d0de6);logger[_0x0fc0('0xc')](_0x0fc0('0x1f'),_0x5d0de6,JSON[_0x0fc0('0x1b')](_0x435f77));_0x1acace(_0x435f77);})['catch'](function(_0x55fcfc){logger[_0x0fc0('0xe')](_0x0fc0('0x1f'),_0x55fcfc['message'],_0x5d0de6);_0x12e23e(_0x39f918[_0x0fc0('0xe')](0x1f4,_0x55fcfc[_0x0fc0('0x11')]));});});};