Built motion from commit 1fd437e9.|2.6.19
[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 _0x5b81=['where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','catch','UpdateVoiceAgentReport','raw'];(function(_0x2d580b,_0x2b11f3){var _0x7c1374=function(_0x4c1a85){while(--_0x4c1a85){_0x2d580b['push'](_0x2d580b['shift']());}};_0x7c1374(++_0x2b11f3);}(_0x5b81,0x18f));var _0x15b8=function(_0x38ec97,_0x1040c9){_0x38ec97=_0x38ec97-0x0;var _0x35e008=_0x5b81[_0x38ec97];return _0x35e008;};'use strict';var _=require(_0x15b8('0x0'));var util=require(_0x15b8('0x1'));var moment=require(_0x15b8('0x2'));var BPromise=require(_0x15b8('0x3'));var rs=require(_0x15b8('0x4'));var fs=require('fs');var Redis=require(_0x15b8('0x5'));var db=require(_0x15b8('0x6'))['db'];var utils=require(_0x15b8('0x7'));var logger=require(_0x15b8('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x15b8('0x9'));var client=jayson[_0x15b8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bec1a,_0x306c70,_0x470bf0){return new BPromise(function(_0x2d4f41,_0x3b1646){return client[_0x15b8('0xb')](_0x1bec1a,_0x470bf0)[_0x15b8('0xc')](function(_0xed06db){logger[_0x15b8('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x306c70,_0x15b8('0xe'));logger[_0x15b8('0xf')](_0x15b8('0x10'),_0x306c70,_0x15b8('0xe'),JSON[_0x15b8('0x11')](_0xed06db));if(_0xed06db[_0x15b8('0x12')]){if(_0xed06db['error'][_0x15b8('0x13')]===0x1f4){logger[_0x15b8('0x12')](_0x15b8('0x14'),_0x306c70,_0xed06db[_0x15b8('0x12')][_0x15b8('0x15')]);return _0x3b1646(_0xed06db[_0x15b8('0x12')][_0x15b8('0x15')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x306c70,_0xed06db[_0x15b8('0x12')]['message']);return _0x2d4f41(_0xed06db[_0x15b8('0x12')][_0x15b8('0x15')]);}else{logger[_0x15b8('0xd')](_0x15b8('0x14'),_0x306c70,_0x15b8('0xe'));_0x2d4f41(_0xed06db['result'][_0x15b8('0x15')]);}})['catch'](function(_0x27d520){logger['error'](_0x15b8('0x14'),_0x306c70,_0x27d520);_0x3b1646(_0x27d520);});});}exports[_0x15b8('0x16')]=function(_0x262361){var _0x4f537f=this;return new Promise(function(_0x4830ab,_0x209173){return db[_0x15b8('0x17')][_0x15b8('0x18')](_0x262361[_0x15b8('0x19')],{'raw':_0x262361[_0x15b8('0x1a')]?_0x262361[_0x15b8('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x15b8('0xc')](function(_0x55686b){logger[_0x15b8('0xd')]('CreateVoiceAgentReport',_0x262361);logger[_0x15b8('0xf')]('CreateVoiceAgentReport',_0x262361,JSON[_0x15b8('0x11')](_0x55686b));_0x4830ab(_0x55686b);})[_0x15b8('0x1b')](function(_0x345f79){logger[_0x15b8('0x12')](_0x15b8('0x16'),_0x345f79[_0x15b8('0x15')],_0x262361);_0x209173(_0x4f537f[_0x15b8('0x12')](0x1f4,_0x345f79[_0x15b8('0x15')]));});});};exports[_0x15b8('0x1c')]=function(_0x426d9c){var _0x23f7ad=this;return new Promise(function(_0x49857b,_0x286837){return db[_0x15b8('0x17')]['update'](_0x426d9c[_0x15b8('0x19')],{'raw':_0x426d9c['options']?_0x426d9c[_0x15b8('0x1a')][_0x15b8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x426d9c[_0x15b8('0x1a')]?_0x426d9c[_0x15b8('0x1a')][_0x15b8('0x1e')]||null:null,'attributes':_0x426d9c[_0x15b8('0x1a')]?_0x426d9c[_0x15b8('0x1a')][_0x15b8('0x1f')]||null:null,'limit':_0x426d9c[_0x15b8('0x1a')]?_0x426d9c[_0x15b8('0x1a')][_0x15b8('0x20')]||null:null})[_0x15b8('0xc')](function(_0x14646f){logger[_0x15b8('0xd')](_0x15b8('0x1c'),_0x426d9c);logger[_0x15b8('0xf')](_0x15b8('0x1c'),_0x426d9c,JSON[_0x15b8('0x11')](_0x14646f));_0x49857b(_0x14646f);})['catch'](function(_0x33e55c){logger['error'](_0x15b8('0x1c'),_0x33e55c[_0x15b8('0x15')],_0x426d9c);_0x286837(_0x23f7ad['error'](0x1f4,_0x33e55c['message']));});});};