bd547dc762ea06370f10a0773b2a3ff9ca3c6e56
[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 _0xa901=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','VoiceAgentReport','create','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','body','where','attributes','limit','catch','lodash','util','moment','bluebird'];(function(_0x374f4,_0x1b7f3e){var _0x42d37c=function(_0x5eaad8){while(--_0x5eaad8){_0x374f4['push'](_0x374f4['shift']());}};_0x42d37c(++_0x1b7f3e);}(_0xa901,0xc2));var _0x1a90=function(_0x3a7f67,_0x12cd6b){_0x3a7f67=_0x3a7f67-0x0;var _0x263b0a=_0xa901[_0x3a7f67];return _0x263b0a;};'use strict';var _=require(_0x1a90('0x0'));var util=require(_0x1a90('0x1'));var moment=require(_0x1a90('0x2'));var BPromise=require(_0x1a90('0x3'));var rs=require(_0x1a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a90('0x5'))['db'];var utils=require(_0x1a90('0x6'));var logger=require('../../config/logger')(_0x1a90('0x7'));var config=require(_0x1a90('0x8'));var jayson=require(_0x1a90('0x9'));var client=jayson['client'][_0x1a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfe8eef,_0x133354,_0x9eae42){return new BPromise(function(_0x2f63d2,_0xcbd2ce){return client[_0x1a90('0xb')](_0xfe8eef,_0x9eae42)[_0x1a90('0xc')](function(_0xc81980){logger[_0x1a90('0xd')](_0x1a90('0xe'),_0x133354,_0x1a90('0xf'));logger[_0x1a90('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x133354,'request\x20sent',JSON[_0x1a90('0x11')](_0xc81980));if(_0xc81980['error']){if(_0xc81980['error']['code']===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x133354,_0xc81980[_0x1a90('0x12')]['message']);return _0xcbd2ce(_0xc81980[_0x1a90('0x12')]['message']);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x133354,_0xc81980[_0x1a90('0x12')][_0x1a90('0x13')]);return _0x2f63d2(_0xc81980[_0x1a90('0x12')][_0x1a90('0x13')]);}else{logger[_0x1a90('0xd')](_0x1a90('0xe'),_0x133354,_0x1a90('0xf'));_0x2f63d2(_0xc81980[_0x1a90('0x14')][_0x1a90('0x13')]);}})['catch'](function(_0x5e90c1){logger[_0x1a90('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x133354,_0x5e90c1);_0xcbd2ce(_0x5e90c1);});});}exports['CreateVoiceAgentReport']=function(_0x33d71f){var _0x24fb88=this;return new Promise(function(_0xfbf635,_0xd4d851){return db[_0x1a90('0x15')][_0x1a90('0x16')](_0x33d71f['body'],{'raw':_0x33d71f['options']?_0x33d71f[_0x1a90('0x17')][_0x1a90('0x18')]===undefined?!![]:![]:!![]})[_0x1a90('0xc')](function(_0x265d63){logger['info'](_0x1a90('0x19'),_0x33d71f);logger['debug'](_0x1a90('0x19'),_0x33d71f,JSON[_0x1a90('0x11')](_0x265d63));_0xfbf635(_0x265d63);})['catch'](function(_0x40fc34){logger[_0x1a90('0x12')]('CreateVoiceAgentReport',_0x40fc34[_0x1a90('0x13')],_0x33d71f);_0xd4d851(_0x24fb88['error'](0x1f4,_0x40fc34[_0x1a90('0x13')]));});});};exports[_0x1a90('0x1a')]=function(_0x1c9599){var _0x465424=this;return new Promise(function(_0x3c9774,_0x58f44d){return db[_0x1a90('0x15')][_0x1a90('0x1b')](_0x1c9599[_0x1a90('0x1c')],{'raw':_0x1c9599['options']?_0x1c9599[_0x1a90('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c9599[_0x1a90('0x17')]?_0x1c9599[_0x1a90('0x17')][_0x1a90('0x1d')]||null:null,'attributes':_0x1c9599[_0x1a90('0x17')]?_0x1c9599['options'][_0x1a90('0x1e')]||null:null,'limit':_0x1c9599[_0x1a90('0x17')]?_0x1c9599[_0x1a90('0x17')][_0x1a90('0x1f')]||null:null})[_0x1a90('0xc')](function(_0x22916a){logger[_0x1a90('0xd')](_0x1a90('0x1a'),_0x1c9599);logger['debug'](_0x1a90('0x1a'),_0x1c9599,JSON['stringify'](_0x22916a));_0x3c9774(_0x22916a);})[_0x1a90('0x20')](function(_0x4f5245){logger[_0x1a90('0x12')](_0x1a90('0x1a'),_0x4f5245[_0x1a90('0x13')],_0x1c9599);_0x58f44d(_0x465424[_0x1a90('0x12')](0x1f4,_0x4f5245['message']));});});};