75ee4082bed0bf1419fe6ab710be7272d492e007
[motion2.git] / server / api / voiceDialReport / voiceDialReport.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 _0x0108=['limit','UpdateVoiceDialReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','create','body','options','VoiceDialReport','update','raw','where'];(function(_0x1424ae,_0x906cb7){var _0x299344=function(_0xb9ee43){while(--_0xb9ee43){_0x1424ae['push'](_0x1424ae['shift']());}};_0x299344(++_0x906cb7);}(_0x0108,0x1d3));var _0x8010=function(_0x32c48c,_0x5d669e){_0x32c48c=_0x32c48c-0x0;var _0x133729=_0x0108[_0x32c48c];return _0x133729;};'use strict';var _=require(_0x8010('0x0'));var util=require(_0x8010('0x1'));var moment=require('moment');var BPromise=require(_0x8010('0x2'));var rs=require(_0x8010('0x3'));var fs=require('fs');var Redis=require(_0x8010('0x4'));var db=require(_0x8010('0x5'))['db'];var utils=require(_0x8010('0x6'));var logger=require('../../config/logger')(_0x8010('0x7'));var config=require(_0x8010('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8010('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c2786,_0x801897,_0x42468e){return new BPromise(function(_0x3ce83b,_0x58325f){return client['request'](_0x2c2786,_0x42468e)[_0x8010('0xa')](function(_0x3ff2d5){logger[_0x8010('0xb')](_0x8010('0xc'),_0x801897,_0x8010('0xd'));logger[_0x8010('0xe')](_0x8010('0xf'),_0x801897,'request\x20sent',JSON[_0x8010('0x10')](_0x3ff2d5));if(_0x3ff2d5[_0x8010('0x11')]){if(_0x3ff2d5[_0x8010('0x11')][_0x8010('0x12')]===0x1f4){logger[_0x8010('0x11')](_0x8010('0xc'),_0x801897,_0x3ff2d5[_0x8010('0x11')][_0x8010('0x13')]);return _0x58325f(_0x3ff2d5[_0x8010('0x11')]['message']);}logger[_0x8010('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x801897,_0x3ff2d5[_0x8010('0x11')][_0x8010('0x13')]);return _0x3ce83b(_0x3ff2d5[_0x8010('0x11')][_0x8010('0x13')]);}else{logger[_0x8010('0xb')](_0x8010('0xc'),_0x801897,_0x8010('0xd'));_0x3ce83b(_0x3ff2d5['result'][_0x8010('0x13')]);}})[_0x8010('0x14')](function(_0x13e423){logger[_0x8010('0x11')](_0x8010('0xc'),_0x801897,_0x13e423);_0x58325f(_0x13e423);});});}exports[_0x8010('0x15')]=function(_0x240e51){var _0x4b0215=this;return new Promise(function(_0x2374c0,_0x123bb7){return db['VoiceDialReport'][_0x8010('0x16')](_0x240e51[_0x8010('0x17')],{'raw':_0x240e51[_0x8010('0x18')]?_0x240e51[_0x8010('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1f976d){logger['info'](_0x8010('0x15'),_0x240e51);logger['debug'](_0x8010('0x15'),_0x240e51,JSON['stringify'](_0x1f976d));_0x2374c0(_0x1f976d);})[_0x8010('0x14')](function(_0x138124){logger['error'](_0x8010('0x15'),_0x138124[_0x8010('0x13')],_0x240e51);_0x123bb7(_0x4b0215[_0x8010('0x11')](0x1f4,_0x138124['message']));});});};exports['UpdateVoiceDialReport']=function(_0x5a2821){var _0x431e50=this;return new Promise(function(_0x29d2db,_0x7e6639){return db[_0x8010('0x19')][_0x8010('0x1a')](_0x5a2821[_0x8010('0x17')],{'raw':_0x5a2821[_0x8010('0x18')]?_0x5a2821['options'][_0x8010('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a2821['options']?_0x5a2821[_0x8010('0x18')][_0x8010('0x1c')]||null:null,'attributes':_0x5a2821[_0x8010('0x18')]?_0x5a2821[_0x8010('0x18')]['attributes']||null:null,'limit':_0x5a2821[_0x8010('0x18')]?_0x5a2821[_0x8010('0x18')][_0x8010('0x1d')]||null:null})[_0x8010('0xa')](function(_0x341ca2){logger[_0x8010('0xb')]('UpdateVoiceDialReport',_0x5a2821);logger[_0x8010('0xe')]('UpdateVoiceDialReport',_0x5a2821,JSON[_0x8010('0x10')](_0x341ca2));_0x29d2db(_0x341ca2);})[_0x8010('0x14')](function(_0x20308c){logger[_0x8010('0x11')](_0x8010('0x1e'),_0x20308c[_0x8010('0x13')],_0x5a2821);_0x7e6639(_0x431e50['error'](0x1f4,_0x20308c[_0x8010('0x13')]));});});};