Built motion from commit 85328c08.|2.5.50
[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 _0x8f1f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','CreateVoiceAgentReport','create','body','options','stringify','catch','UpdateVoiceAgentReport','update','raw','where','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0x8f1f,0x102));var _0xf8f1=function(_0x4f357d,_0x3dae2d){_0x4f357d=_0x4f357d-0x0;var _0x21af41=_0x8f1f[_0x4f357d];return _0x21af41;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf8f1('0x0'));var BPromise=require(_0xf8f1('0x1'));var rs=require(_0xf8f1('0x2'));var fs=require('fs');var Redis=require(_0xf8f1('0x3'));var db=require(_0xf8f1('0x4'))['db'];var utils=require(_0xf8f1('0x5'));var logger=require(_0xf8f1('0x6'))(_0xf8f1('0x7'));var config=require(_0xf8f1('0x8'));var jayson=require(_0xf8f1('0x9'));var client=jayson[_0xf8f1('0xa')][_0xf8f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1efd7a,_0x139d43,_0x58d811){return new BPromise(function(_0x3ffe67,_0x161654){return client[_0xf8f1('0xc')](_0x1efd7a,_0x58d811)[_0xf8f1('0xd')](function(_0x4f5c89){logger[_0xf8f1('0xe')](_0xf8f1('0xf'),_0x139d43,'request\x20sent');logger[_0xf8f1('0x10')](_0xf8f1('0x11'),_0x139d43,_0xf8f1('0x12'),JSON['stringify'](_0x4f5c89));if(_0x4f5c89[_0xf8f1('0x13')]){if(_0x4f5c89['error']['code']===0x1f4){logger[_0xf8f1('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x139d43,_0x4f5c89[_0xf8f1('0x13')]['message']);return _0x161654(_0x4f5c89[_0xf8f1('0x13')][_0xf8f1('0x14')]);}logger[_0xf8f1('0x13')](_0xf8f1('0xf'),_0x139d43,_0x4f5c89[_0xf8f1('0x13')][_0xf8f1('0x14')]);return _0x3ffe67(_0x4f5c89['error'][_0xf8f1('0x14')]);}else{logger[_0xf8f1('0xe')](_0xf8f1('0xf'),_0x139d43,'request\x20sent');_0x3ffe67(_0x4f5c89[_0xf8f1('0x15')]['message']);}})['catch'](function(_0x2c5856){logger[_0xf8f1('0x13')](_0xf8f1('0xf'),_0x139d43,_0x2c5856);_0x161654(_0x2c5856);});});}exports[_0xf8f1('0x16')]=function(_0x4d248e){var _0x43736a=this;return new Promise(function(_0x2b2ea5,_0x3187c4){return db['VoiceAgentReport'][_0xf8f1('0x17')](_0x4d248e[_0xf8f1('0x18')],{'raw':_0x4d248e[_0xf8f1('0x19')]?_0x4d248e[_0xf8f1('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xf8f1('0xd')](function(_0xd7870a){logger[_0xf8f1('0xe')]('CreateVoiceAgentReport',_0x4d248e);logger[_0xf8f1('0x10')]('CreateVoiceAgentReport',_0x4d248e,JSON[_0xf8f1('0x1a')](_0xd7870a));_0x2b2ea5(_0xd7870a);})[_0xf8f1('0x1b')](function(_0x359514){logger[_0xf8f1('0x13')]('CreateVoiceAgentReport',_0x359514[_0xf8f1('0x14')],_0x4d248e);_0x3187c4(_0x43736a[_0xf8f1('0x13')](0x1f4,_0x359514['message']));});});};exports[_0xf8f1('0x1c')]=function(_0x5cd617){var _0x529850=this;return new Promise(function(_0x2302a8,_0x16481a){return db['VoiceAgentReport'][_0xf8f1('0x1d')](_0x5cd617[_0xf8f1('0x18')],{'raw':_0x5cd617[_0xf8f1('0x19')]?_0x5cd617[_0xf8f1('0x19')][_0xf8f1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cd617[_0xf8f1('0x19')]?_0x5cd617['options'][_0xf8f1('0x1f')]||null:null,'attributes':_0x5cd617[_0xf8f1('0x19')]?_0x5cd617[_0xf8f1('0x19')]['attributes']||null:null,'limit':_0x5cd617[_0xf8f1('0x19')]?_0x5cd617[_0xf8f1('0x19')][_0xf8f1('0x20')]||null:null})[_0xf8f1('0xd')](function(_0x25a3fd){logger[_0xf8f1('0xe')]('UpdateVoiceAgentReport',_0x5cd617);logger['debug']('UpdateVoiceAgentReport',_0x5cd617,JSON[_0xf8f1('0x1a')](_0x25a3fd));_0x2302a8(_0x25a3fd);})[_0xf8f1('0x1b')](function(_0xad67d0){logger[_0xf8f1('0x13')]('UpdateVoiceAgentReport',_0xad67d0[_0xf8f1('0x14')],_0x5cd617);_0x16481a(_0x529850[_0xf8f1('0x13')](0x1f4,_0xad67d0[_0xf8f1('0x14')]));});});};