56cb44d51f728ed7a361195673b964e1adc4b5ee
[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 _0x251b=['VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','stringify','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','result','catch'];(function(_0x185c1a,_0x38423c){var _0x4955df=function(_0x5aa635){while(--_0x5aa635){_0x185c1a['push'](_0x185c1a['shift']());}};_0x4955df(++_0x38423c);}(_0x251b,0x90));var _0xb251=function(_0x47bc5e,_0x6fc500){_0x47bc5e=_0x47bc5e-0x0;var _0x323a59=_0x251b[_0x47bc5e];return _0x323a59;};'use strict';var _=require(_0xb251('0x0'));var util=require('util');var moment=require(_0xb251('0x1'));var BPromise=require('bluebird');var rs=require(_0xb251('0x2'));var fs=require('fs');var Redis=require(_0xb251('0x3'));var db=require(_0xb251('0x4'))['db'];var utils=require(_0xb251('0x5'));var logger=require(_0xb251('0x6'))('rpc');var config=require(_0xb251('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb251('0x8')][_0xb251('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43dd1d,_0x18f38a,_0x2dcd1d){return new BPromise(function(_0x75710b,_0x1493ef){return client['request'](_0x43dd1d,_0x2dcd1d)[_0xb251('0xa')](function(_0x5ebbfe){logger[_0xb251('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x18f38a,'request\x20sent');logger[_0xb251('0xc')](_0xb251('0xd'),_0x18f38a,'request\x20sent',JSON['stringify'](_0x5ebbfe));if(_0x5ebbfe[_0xb251('0xe')]){if(_0x5ebbfe[_0xb251('0xe')][_0xb251('0xf')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x18f38a,_0x5ebbfe[_0xb251('0xe')][_0xb251('0x10')]);return _0x1493ef(_0x5ebbfe[_0xb251('0xe')]['message']);}logger['error'](_0xb251('0x11'),_0x18f38a,_0x5ebbfe[_0xb251('0xe')][_0xb251('0x10')]);return _0x75710b(_0x5ebbfe[_0xb251('0xe')]['message']);}else{logger[_0xb251('0xb')](_0xb251('0x11'),_0x18f38a,_0xb251('0x12'));_0x75710b(_0x5ebbfe[_0xb251('0x13')]['message']);}})[_0xb251('0x14')](function(_0x25e1c5){logger[_0xb251('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x18f38a,_0x25e1c5);_0x1493ef(_0x25e1c5);});});}exports['CreateVoiceAgentReport']=function(_0x8a616){var _0x239f4a=this;return new Promise(function(_0x5ab03a,_0x31a28d){return db[_0xb251('0x15')][_0xb251('0x16')](_0x8a616[_0xb251('0x17')],{'raw':_0x8a616['options']?_0x8a616[_0xb251('0x18')][_0xb251('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2f754f){logger['info'](_0xb251('0x1a'),_0x8a616);logger[_0xb251('0xc')](_0xb251('0x1a'),_0x8a616,JSON[_0xb251('0x1b')](_0x2f754f));_0x5ab03a(_0x2f754f);})[_0xb251('0x14')](function(_0x5d3ad1){logger[_0xb251('0xe')]('CreateVoiceAgentReport',_0x5d3ad1[_0xb251('0x10')],_0x8a616);_0x31a28d(_0x239f4a['error'](0x1f4,_0x5d3ad1[_0xb251('0x10')]));});});};exports[_0xb251('0x1c')]=function(_0x37c7b8){var _0x433611=this;return new Promise(function(_0x2219c6,_0x3112b0){return db[_0xb251('0x15')][_0xb251('0x1d')](_0x37c7b8[_0xb251('0x17')],{'raw':_0x37c7b8[_0xb251('0x18')]?_0x37c7b8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37c7b8[_0xb251('0x18')]?_0x37c7b8[_0xb251('0x18')][_0xb251('0x1e')]||null:null,'attributes':_0x37c7b8[_0xb251('0x18')]?_0x37c7b8['options'][_0xb251('0x1f')]||null:null,'limit':_0x37c7b8[_0xb251('0x18')]?_0x37c7b8[_0xb251('0x18')][_0xb251('0x20')]||null:null})[_0xb251('0xa')](function(_0xbe8c50){logger[_0xb251('0xb')](_0xb251('0x1c'),_0x37c7b8);logger['debug']('UpdateVoiceAgentReport',_0x37c7b8,JSON[_0xb251('0x1b')](_0xbe8c50));_0x2219c6(_0xbe8c50);})['catch'](function(_0x2f2bb0){logger[_0xb251('0xe')](_0xb251('0x1c'),_0x2f2bb0[_0xb251('0x10')],_0x37c7b8);_0x3112b0(_0x433611[_0xb251('0xe')](0x1f4,_0x2f2bb0['message']));});});};