Built motion from commit (unavailable).|2.4.10
[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 _0x3857=['stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','update','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','info','VoiceAgentReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x3857,0xef));var _0x7385=function(_0x51f152,_0x4522b0){_0x51f152=_0x51f152-0x0;var _0x460cbb=_0x3857[_0x51f152];return _0x460cbb;};'use strict';var _=require(_0x7385('0x0'));var util=require(_0x7385('0x1'));var moment=require(_0x7385('0x2'));var BPromise=require(_0x7385('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7385('0x4'));var db=require(_0x7385('0x5'))['db'];var utils=require(_0x7385('0x6'));var logger=require('../../config/logger')(_0x7385('0x7'));var config=require('../../config/environment');var jayson=require(_0x7385('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1edc07,_0x15a2d1,_0x4bc029){return new BPromise(function(_0x2ad105,_0x417463){return client['request'](_0x1edc07,_0x4bc029)['then'](function(_0x32e2c4){logger[_0x7385('0x9')](_0x7385('0xa'),_0x15a2d1,'request\x20sent');logger[_0x7385('0xb')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x15a2d1,_0x7385('0xc'),JSON[_0x7385('0xd')](_0x32e2c4));if(_0x32e2c4['error']){if(_0x32e2c4[_0x7385('0xe')]['code']===0x1f4){logger[_0x7385('0xe')](_0x7385('0xa'),_0x15a2d1,_0x32e2c4[_0x7385('0xe')]['message']);return _0x417463(_0x32e2c4[_0x7385('0xe')][_0x7385('0xf')]);}logger['error'](_0x7385('0xa'),_0x15a2d1,_0x32e2c4[_0x7385('0xe')]['message']);return _0x2ad105(_0x32e2c4[_0x7385('0xe')]['message']);}else{logger[_0x7385('0x9')](_0x7385('0xa'),_0x15a2d1,_0x7385('0xc'));_0x2ad105(_0x32e2c4[_0x7385('0x10')][_0x7385('0xf')]);}})[_0x7385('0x11')](function(_0x106fe2){logger['error'](_0x7385('0xa'),_0x15a2d1,_0x106fe2);_0x417463(_0x106fe2);});});}exports[_0x7385('0x12')]=function(_0x50799d){var _0xf0eb7b=this;return new Promise(function(_0x65de13,_0x5ca5c7){return db[_0x7385('0x13')][_0x7385('0x14')](_0x50799d[_0x7385('0x15')],{'raw':_0x50799d[_0x7385('0x16')]?_0x50799d[_0x7385('0x16')][_0x7385('0x17')]===undefined?!![]:![]:!![]})[_0x7385('0x18')](function(_0x24772d){logger[_0x7385('0x9')]('CreateVoiceAgentReport',_0x50799d);logger['debug'](_0x7385('0x12'),_0x50799d,JSON['stringify'](_0x24772d));_0x65de13(_0x24772d);})[_0x7385('0x11')](function(_0x48a1c8){logger[_0x7385('0xe')]('CreateVoiceAgentReport',_0x48a1c8[_0x7385('0xf')],_0x50799d);_0x5ca5c7(_0xf0eb7b[_0x7385('0xe')](0x1f4,_0x48a1c8[_0x7385('0xf')]));});});};exports['UpdateVoiceAgentReport']=function(_0x2e300d){var _0x39eac1=this;return new Promise(function(_0x3043d2,_0x202310){return db[_0x7385('0x13')][_0x7385('0x19')](_0x2e300d[_0x7385('0x15')],{'raw':_0x2e300d[_0x7385('0x16')]?_0x2e300d['options'][_0x7385('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e300d[_0x7385('0x16')]?_0x2e300d[_0x7385('0x16')]['where']||null:null,'attributes':_0x2e300d[_0x7385('0x16')]?_0x2e300d[_0x7385('0x16')]['attributes']||null:null,'limit':_0x2e300d[_0x7385('0x16')]?_0x2e300d[_0x7385('0x16')][_0x7385('0x1a')]||null:null})[_0x7385('0x18')](function(_0x123fc0){logger[_0x7385('0x9')](_0x7385('0x1b'),_0x2e300d);logger[_0x7385('0xb')](_0x7385('0x1b'),_0x2e300d,JSON[_0x7385('0xd')](_0x123fc0));_0x3043d2(_0x123fc0);})[_0x7385('0x11')](function(_0x38b944){logger[_0x7385('0xe')](_0x7385('0x1b'),_0x38b944[_0x7385('0xf')],_0x2e300d);_0x202310(_0x39eac1['error'](0x1f4,_0x38b944['message']));});});};