Built motion from commit 15aa0e42.|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 _0x02a3=['where','attributes','limit','UpdateVoiceAgentReport','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','catch','VoiceAgentReport','create','options','raw','CreateVoiceAgentReport','body'];(function(_0x185c4c,_0x3f9923){var _0x584882=function(_0x3bf6ff){while(--_0x3bf6ff){_0x185c4c['push'](_0x185c4c['shift']());}};_0x584882(++_0x3f9923);}(_0x02a3,0x1a9));var _0x302a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x02a3[_0x4d613c];return _0x301fe3;};'use strict';var _=require('lodash');var util=require(_0x302a('0x0'));var moment=require(_0x302a('0x1'));var BPromise=require(_0x302a('0x2'));var rs=require(_0x302a('0x3'));var fs=require('fs');var Redis=require(_0x302a('0x4'));var db=require(_0x302a('0x5'))['db'];var utils=require(_0x302a('0x6'));var logger=require(_0x302a('0x7'))(_0x302a('0x8'));var config=require('../../config/environment');var jayson=require(_0x302a('0x9'));var client=jayson[_0x302a('0xa')][_0x302a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35f5e2,_0x418879,_0x445989){return new BPromise(function(_0x328db4,_0x2a54f8){return client[_0x302a('0xc')](_0x35f5e2,_0x445989)[_0x302a('0xd')](function(_0x5d8056){logger[_0x302a('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x418879,_0x302a('0xf'));logger[_0x302a('0x10')](_0x302a('0x11'),_0x418879,_0x302a('0xf'),JSON['stringify'](_0x5d8056));if(_0x5d8056[_0x302a('0x12')]){if(_0x5d8056[_0x302a('0x12')][_0x302a('0x13')]===0x1f4){logger[_0x302a('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x418879,_0x5d8056[_0x302a('0x12')][_0x302a('0x14')]);return _0x2a54f8(_0x5d8056[_0x302a('0x12')][_0x302a('0x14')]);}logger[_0x302a('0x12')](_0x302a('0x15'),_0x418879,_0x5d8056[_0x302a('0x12')][_0x302a('0x14')]);return _0x328db4(_0x5d8056[_0x302a('0x12')][_0x302a('0x14')]);}else{logger[_0x302a('0xe')](_0x302a('0x15'),_0x418879,'request\x20sent');_0x328db4(_0x5d8056[_0x302a('0x16')][_0x302a('0x14')]);}})[_0x302a('0x17')](function(_0x3fc4d7){logger['error'](_0x302a('0x15'),_0x418879,_0x3fc4d7);_0x2a54f8(_0x3fc4d7);});});}exports['CreateVoiceAgentReport']=function(_0x27d7a6){var _0x2aefe6=this;return new Promise(function(_0x2a763e,_0x1cef13){return db[_0x302a('0x18')][_0x302a('0x19')](_0x27d7a6['body'],{'raw':_0x27d7a6['options']?_0x27d7a6[_0x302a('0x1a')][_0x302a('0x1b')]===undefined?!![]:![]:!![]})[_0x302a('0xd')](function(_0x3b7542){logger[_0x302a('0xe')](_0x302a('0x1c'),_0x27d7a6);logger['debug'](_0x302a('0x1c'),_0x27d7a6,JSON['stringify'](_0x3b7542));_0x2a763e(_0x3b7542);})[_0x302a('0x17')](function(_0x405339){logger[_0x302a('0x12')](_0x302a('0x1c'),_0x405339[_0x302a('0x14')],_0x27d7a6);_0x1cef13(_0x2aefe6['error'](0x1f4,_0x405339[_0x302a('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x41d0b5){var _0x48577f=this;return new Promise(function(_0x324041,_0x5d62f8){return db[_0x302a('0x18')]['update'](_0x41d0b5[_0x302a('0x1d')],{'raw':_0x41d0b5['options']?_0x41d0b5[_0x302a('0x1a')][_0x302a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41d0b5[_0x302a('0x1a')]?_0x41d0b5['options'][_0x302a('0x1e')]||null:null,'attributes':_0x41d0b5['options']?_0x41d0b5[_0x302a('0x1a')][_0x302a('0x1f')]||null:null,'limit':_0x41d0b5['options']?_0x41d0b5['options'][_0x302a('0x20')]||null:null})[_0x302a('0xd')](function(_0x1d3a29){logger[_0x302a('0xe')](_0x302a('0x21'),_0x41d0b5);logger[_0x302a('0x10')]('UpdateVoiceAgentReport',_0x41d0b5,JSON[_0x302a('0x22')](_0x1d3a29));_0x324041(_0x1d3a29);})[_0x302a('0x17')](function(_0x20ef7b){logger[_0x302a('0x12')](_0x302a('0x21'),_0x20ef7b[_0x302a('0x14')],_0x41d0b5);_0x5d62f8(_0x48577f[_0x302a('0x12')](0x1f4,_0x20ef7b[_0x302a('0x14')]));});});};