Built motion from commit (unavailable).|2.6.0
[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 _0xae7c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','CreateVoiceAgentReport','create','body','raw','update','options','where','UpdateVoiceAgentReport','debug','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1d6505,_0x2f62f7){var _0x45e9a4=function(_0x3cda3f){while(--_0x3cda3f){_0x1d6505['push'](_0x1d6505['shift']());}};_0x45e9a4(++_0x2f62f7);}(_0xae7c,0x10a));var _0xcae7=function(_0x1f4d1a,_0x2af6c4){_0x1f4d1a=_0x1f4d1a-0x0;var _0x2efebd=_0xae7c[_0x1f4d1a];return _0x2efebd;};'use strict';var _=require(_0xcae7('0x0'));var util=require(_0xcae7('0x1'));var moment=require(_0xcae7('0x2'));var BPromise=require(_0xcae7('0x3'));var rs=require(_0xcae7('0x4'));var fs=require('fs');var Redis=require(_0xcae7('0x5'));var db=require(_0xcae7('0x6'))['db'];var utils=require(_0xcae7('0x7'));var logger=require(_0xcae7('0x8'))(_0xcae7('0x9'));var config=require(_0xcae7('0xa'));var jayson=require(_0xcae7('0xb'));var client=jayson[_0xcae7('0xc')][_0xcae7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xa7c1c,_0x1df7d3,_0x1a7717){return new BPromise(function(_0x14e6b9,_0xc6b853){return client[_0xcae7('0xe')](_0xa7c1c,_0x1a7717)[_0xcae7('0xf')](function(_0x13745c){logger['info'](_0xcae7('0x10'),_0x1df7d3,_0xcae7('0x11'));logger['debug'](_0xcae7('0x12'),_0x1df7d3,_0xcae7('0x11'),JSON[_0xcae7('0x13')](_0x13745c));if(_0x13745c['error']){if(_0x13745c['error'][_0xcae7('0x14')]===0x1f4){logger['error'](_0xcae7('0x10'),_0x1df7d3,_0x13745c[_0xcae7('0x15')]['message']);return _0xc6b853(_0x13745c[_0xcae7('0x15')][_0xcae7('0x16')]);}logger[_0xcae7('0x15')](_0xcae7('0x10'),_0x1df7d3,_0x13745c[_0xcae7('0x15')]['message']);return _0x14e6b9(_0x13745c[_0xcae7('0x15')]['message']);}else{logger[_0xcae7('0x17')](_0xcae7('0x10'),_0x1df7d3,'request\x20sent');_0x14e6b9(_0x13745c['result'][_0xcae7('0x16')]);}})[_0xcae7('0x18')](function(_0x246478){logger[_0xcae7('0x15')](_0xcae7('0x10'),_0x1df7d3,_0x246478);_0xc6b853(_0x246478);});});}exports[_0xcae7('0x19')]=function(_0x189441){var _0x54763f=this;return new Promise(function(_0x1e9a57,_0x359b4b){return db['VoiceAgentReport'][_0xcae7('0x1a')](_0x189441[_0xcae7('0x1b')],{'raw':_0x189441['options']?_0x189441['options'][_0xcae7('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5ca79b){logger[_0xcae7('0x17')](_0xcae7('0x19'),_0x189441);logger['debug'](_0xcae7('0x19'),_0x189441,JSON[_0xcae7('0x13')](_0x5ca79b));_0x1e9a57(_0x5ca79b);})[_0xcae7('0x18')](function(_0x5d6d5b){logger[_0xcae7('0x15')](_0xcae7('0x19'),_0x5d6d5b[_0xcae7('0x16')],_0x189441);_0x359b4b(_0x54763f[_0xcae7('0x15')](0x1f4,_0x5d6d5b['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x1e01c5){var _0x13d325=this;return new Promise(function(_0x443154,_0x1af50b){return db['VoiceAgentReport'][_0xcae7('0x1d')](_0x1e01c5[_0xcae7('0x1b')],{'raw':_0x1e01c5[_0xcae7('0x1e')]?_0x1e01c5[_0xcae7('0x1e')][_0xcae7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e01c5['options']?_0x1e01c5[_0xcae7('0x1e')][_0xcae7('0x1f')]||null:null,'attributes':_0x1e01c5[_0xcae7('0x1e')]?_0x1e01c5[_0xcae7('0x1e')]['attributes']||null:null,'limit':_0x1e01c5[_0xcae7('0x1e')]?_0x1e01c5[_0xcae7('0x1e')]['limit']||null:null})[_0xcae7('0xf')](function(_0xe97c2b){logger[_0xcae7('0x17')](_0xcae7('0x20'),_0x1e01c5);logger[_0xcae7('0x21')](_0xcae7('0x20'),_0x1e01c5,JSON['stringify'](_0xe97c2b));_0x443154(_0xe97c2b);})['catch'](function(_0x54c9ee){logger[_0xcae7('0x15')](_0xcae7('0x20'),_0x54c9ee['message'],_0x1e01c5);_0x1af50b(_0x13d325[_0xcae7('0x15')](0x1f4,_0x54c9ee[_0xcae7('0x16')]));});});};