23784dbdb2e33a5b2a1cfa64a517d69a4c1f1617
[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 _0x2cd9=['create','body','options','raw','UpdateVoiceDialReport','VoiceDialReport','update','where','stringify','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateVoiceDialReport'];(function(_0x567b64,_0x32ff3b){var _0x35c391=function(_0x3908c0){while(--_0x3908c0){_0x567b64['push'](_0x567b64['shift']());}};_0x35c391(++_0x32ff3b);}(_0x2cd9,0x153));var _0x92cd=function(_0x34ed00,_0x114526){_0x34ed00=_0x34ed00-0x0;var _0x4fabf1=_0x2cd9[_0x34ed00];return _0x4fabf1;};'use strict';var _=require(_0x92cd('0x0'));var util=require(_0x92cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92cd('0x2'))['db'];var utils=require(_0x92cd('0x3'));var logger=require(_0x92cd('0x4'))(_0x92cd('0x5'));var config=require('../../config/environment');var jayson=require(_0x92cd('0x6'));var client=jayson[_0x92cd('0x7')][_0x92cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x516407,_0x523467,_0x4ea46f){return new BPromise(function(_0xe11a5a,_0x400d65){return client[_0x92cd('0x9')](_0x516407,_0x4ea46f)[_0x92cd('0xa')](function(_0x2e9d7a){logger[_0x92cd('0xb')](_0x92cd('0xc'),_0x523467,'request\x20sent');logger[_0x92cd('0xd')](_0x92cd('0xe'),_0x523467,_0x92cd('0xf'),JSON['stringify'](_0x2e9d7a));if(_0x2e9d7a['error']){if(_0x2e9d7a[_0x92cd('0x10')][_0x92cd('0x11')]===0x1f4){logger[_0x92cd('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x523467,_0x2e9d7a['error']['message']);return _0x400d65(_0x2e9d7a[_0x92cd('0x10')][_0x92cd('0x12')]);}logger[_0x92cd('0x10')](_0x92cd('0xc'),_0x523467,_0x2e9d7a[_0x92cd('0x10')]['message']);return _0xe11a5a(_0x2e9d7a[_0x92cd('0x10')][_0x92cd('0x12')]);}else{logger[_0x92cd('0xb')](_0x92cd('0xc'),_0x523467,_0x92cd('0xf'));_0xe11a5a(_0x2e9d7a['result'][_0x92cd('0x12')]);}})[_0x92cd('0x13')](function(_0x44687d){logger[_0x92cd('0x10')](_0x92cd('0xc'),_0x523467,_0x44687d);_0x400d65(_0x44687d);});});}exports[_0x92cd('0x14')]=function(_0x217e66){var _0x5e0531=this;return new Promise(function(_0x17e5ca,_0x205bfb){return db['VoiceDialReport'][_0x92cd('0x15')](_0x217e66[_0x92cd('0x16')],{'raw':_0x217e66['options']?_0x217e66[_0x92cd('0x17')][_0x92cd('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xa7745f){logger[_0x92cd('0xb')](_0x92cd('0x14'),_0x217e66);logger[_0x92cd('0xd')]('CreateVoiceDialReport',_0x217e66,JSON['stringify'](_0xa7745f));_0x17e5ca(_0xa7745f);})[_0x92cd('0x13')](function(_0xcdbdf5){logger[_0x92cd('0x10')]('CreateVoiceDialReport',_0xcdbdf5[_0x92cd('0x12')],_0x217e66);_0x205bfb(_0x5e0531[_0x92cd('0x10')](0x1f4,_0xcdbdf5[_0x92cd('0x12')]));});});};exports[_0x92cd('0x19')]=function(_0x3831c6){var _0x5465a3=this;return new Promise(function(_0x5f30b1,_0x13c429){return db[_0x92cd('0x1a')][_0x92cd('0x1b')](_0x3831c6[_0x92cd('0x16')],{'raw':_0x3831c6[_0x92cd('0x17')]?_0x3831c6[_0x92cd('0x17')][_0x92cd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3831c6[_0x92cd('0x17')]?_0x3831c6[_0x92cd('0x17')][_0x92cd('0x1c')]||null:null,'attributes':_0x3831c6[_0x92cd('0x17')]?_0x3831c6[_0x92cd('0x17')]['attributes']||null:null,'limit':_0x3831c6[_0x92cd('0x17')]?_0x3831c6[_0x92cd('0x17')]['limit']||null:null})[_0x92cd('0xa')](function(_0x3996be){logger['info'](_0x92cd('0x19'),_0x3831c6);logger[_0x92cd('0xd')](_0x92cd('0x19'),_0x3831c6,JSON[_0x92cd('0x1d')](_0x3996be));_0x5f30b1(_0x3996be);})[_0x92cd('0x13')](function(_0x359c06){logger['error'](_0x92cd('0x19'),_0x359c06[_0x92cd('0x12')],_0x3831c6);_0x13c429(_0x5465a3[_0x92cd('0x10')](0x1f4,_0x359c06[_0x92cd('0x12')]));});});};