cdc058eaf792c9165d4f1242ed5cbe4d66d4fd68
[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 _0xffc9=['create','options','stringify','UpdateVoiceAgentReport','update','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateVoiceAgentReport','VoiceAgentReport'];(function(_0x3cc525,_0x597ac8){var _0x3f69fe=function(_0xde6d80){while(--_0xde6d80){_0x3cc525['push'](_0x3cc525['shift']());}};_0x3f69fe(++_0x597ac8);}(_0xffc9,0x151));var _0x9ffc=function(_0x20f37d,_0x20a575){_0x20f37d=_0x20f37d-0x0;var _0x35e958=_0xffc9[_0x20f37d];return _0x35e958;};'use strict';var _=require(_0x9ffc('0x0'));var util=require(_0x9ffc('0x1'));var moment=require('moment');var BPromise=require(_0x9ffc('0x2'));var rs=require(_0x9ffc('0x3'));var fs=require('fs');var Redis=require(_0x9ffc('0x4'));var db=require(_0x9ffc('0x5'))['db'];var utils=require(_0x9ffc('0x6'));var logger=require(_0x9ffc('0x7'))(_0x9ffc('0x8'));var config=require(_0x9ffc('0x9'));var jayson=require(_0x9ffc('0xa'));var client=jayson['client'][_0x9ffc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a3a4e,_0x241585,_0x5521ed){return new BPromise(function(_0x4371f4,_0x6daf6c){return client[_0x9ffc('0xc')](_0x4a3a4e,_0x5521ed)[_0x9ffc('0xd')](function(_0x565319){logger[_0x9ffc('0xe')](_0x9ffc('0xf'),_0x241585,'request\x20sent');logger[_0x9ffc('0x10')](_0x9ffc('0x11'),_0x241585,'request\x20sent',JSON['stringify'](_0x565319));if(_0x565319[_0x9ffc('0x12')]){if(_0x565319[_0x9ffc('0x12')][_0x9ffc('0x13')]===0x1f4){logger['error'](_0x9ffc('0xf'),_0x241585,_0x565319[_0x9ffc('0x12')]['message']);return _0x6daf6c(_0x565319[_0x9ffc('0x12')][_0x9ffc('0x14')]);}logger[_0x9ffc('0x12')](_0x9ffc('0xf'),_0x241585,_0x565319[_0x9ffc('0x12')][_0x9ffc('0x14')]);return _0x4371f4(_0x565319[_0x9ffc('0x12')][_0x9ffc('0x14')]);}else{logger['info'](_0x9ffc('0xf'),_0x241585,_0x9ffc('0x15'));_0x4371f4(_0x565319[_0x9ffc('0x16')][_0x9ffc('0x14')]);}})[_0x9ffc('0x17')](function(_0xdda002){logger[_0x9ffc('0x12')](_0x9ffc('0xf'),_0x241585,_0xdda002);_0x6daf6c(_0xdda002);});});}exports[_0x9ffc('0x18')]=function(_0x4d2d73){var _0x58c905=this;return new Promise(function(_0x361fee,_0x304534){return db[_0x9ffc('0x19')][_0x9ffc('0x1a')](_0x4d2d73['body'],{'raw':_0x4d2d73[_0x9ffc('0x1b')]?_0x4d2d73['options']['raw']===undefined?!![]:![]:!![]})[_0x9ffc('0xd')](function(_0x2dfa46){logger[_0x9ffc('0xe')]('CreateVoiceAgentReport',_0x4d2d73);logger[_0x9ffc('0x10')](_0x9ffc('0x18'),_0x4d2d73,JSON[_0x9ffc('0x1c')](_0x2dfa46));_0x361fee(_0x2dfa46);})[_0x9ffc('0x17')](function(_0x40c7f0){logger[_0x9ffc('0x12')](_0x9ffc('0x18'),_0x40c7f0[_0x9ffc('0x14')],_0x4d2d73);_0x304534(_0x58c905[_0x9ffc('0x12')](0x1f4,_0x40c7f0[_0x9ffc('0x14')]));});});};exports[_0x9ffc('0x1d')]=function(_0x2a8c45){var _0x1d3607=this;return new Promise(function(_0x40ddae,_0xca5bc3){return db[_0x9ffc('0x19')][_0x9ffc('0x1e')](_0x2a8c45['body'],{'raw':_0x2a8c45[_0x9ffc('0x1b')]?_0x2a8c45[_0x9ffc('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a8c45['options']?_0x2a8c45[_0x9ffc('0x1b')][_0x9ffc('0x1f')]||null:null,'attributes':_0x2a8c45[_0x9ffc('0x1b')]?_0x2a8c45[_0x9ffc('0x1b')][_0x9ffc('0x20')]||null:null,'limit':_0x2a8c45[_0x9ffc('0x1b')]?_0x2a8c45['options']['limit']||null:null})[_0x9ffc('0xd')](function(_0x39d2ab){logger[_0x9ffc('0xe')](_0x9ffc('0x1d'),_0x2a8c45);logger['debug'](_0x9ffc('0x1d'),_0x2a8c45,JSON['stringify'](_0x39d2ab));_0x40ddae(_0x39d2ab);})[_0x9ffc('0x17')](function(_0x9728e2){logger[_0x9ffc('0x12')](_0x9ffc('0x1d'),_0x9728e2[_0x9ffc('0x14')],_0x2a8c45);_0xca5bc3(_0x1d3607[_0x9ffc('0x12')](0x1f4,_0x9728e2['message']));});});};