5964335a1520d67979bc1d793eaf95fb66d9b96b
[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 _0x07f0=['error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','options','UpdateVoiceDialReport','update','body','raw','where','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4f9d3c,_0x23d6e0){var _0x3ab489=function(_0x1d8f3e){while(--_0x1d8f3e){_0x4f9d3c['push'](_0x4f9d3c['shift']());}};_0x3ab489(++_0x23d6e0);}(_0x07f0,0xfd));var _0x007f=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x07f0[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x007f('0x0'));var util=require(_0x007f('0x1'));var moment=require(_0x007f('0x2'));var BPromise=require(_0x007f('0x3'));var rs=require(_0x007f('0x4'));var fs=require('fs');var Redis=require(_0x007f('0x5'));var db=require(_0x007f('0x6'))['db'];var utils=require(_0x007f('0x7'));var logger=require(_0x007f('0x8'))(_0x007f('0x9'));var config=require('../../config/environment');var jayson=require(_0x007f('0xa'));var client=jayson[_0x007f('0xb')][_0x007f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x260ce3,_0x2d7dcd,_0xca7e57){return new BPromise(function(_0xccc612,_0x3539f0){return client[_0x007f('0xd')](_0x260ce3,_0xca7e57)[_0x007f('0xe')](function(_0x47e23a){logger[_0x007f('0xf')](_0x007f('0x10'),_0x2d7dcd,_0x007f('0x11'));logger[_0x007f('0x12')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2d7dcd,_0x007f('0x11'),JSON['stringify'](_0x47e23a));if(_0x47e23a[_0x007f('0x13')]){if(_0x47e23a[_0x007f('0x13')][_0x007f('0x14')]===0x1f4){logger[_0x007f('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x2d7dcd,_0x47e23a[_0x007f('0x13')][_0x007f('0x15')]);return _0x3539f0(_0x47e23a[_0x007f('0x13')][_0x007f('0x15')]);}logger[_0x007f('0x13')](_0x007f('0x10'),_0x2d7dcd,_0x47e23a[_0x007f('0x13')][_0x007f('0x15')]);return _0xccc612(_0x47e23a[_0x007f('0x13')]['message']);}else{logger['info'](_0x007f('0x10'),_0x2d7dcd,_0x007f('0x11'));_0xccc612(_0x47e23a['result'][_0x007f('0x15')]);}})[_0x007f('0x16')](function(_0x11cfd8){logger[_0x007f('0x13')](_0x007f('0x10'),_0x2d7dcd,_0x11cfd8);_0x3539f0(_0x11cfd8);});});}exports[_0x007f('0x17')]=function(_0x53e40b){var _0x6966ad=this;return new Promise(function(_0x10cc86,_0x4b30fa){return db[_0x007f('0x18')][_0x007f('0x19')](_0x53e40b['body'],{'raw':_0x53e40b[_0x007f('0x1a')]?_0x53e40b[_0x007f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x007f('0xe')](function(_0x54da2c){logger[_0x007f('0xf')]('CreateVoiceDialReport',_0x53e40b);logger[_0x007f('0x12')](_0x007f('0x17'),_0x53e40b,JSON['stringify'](_0x54da2c));_0x10cc86(_0x54da2c);})['catch'](function(_0x3aef30){logger['error'](_0x007f('0x17'),_0x3aef30[_0x007f('0x15')],_0x53e40b);_0x4b30fa(_0x6966ad[_0x007f('0x13')](0x1f4,_0x3aef30['message']));});});};exports[_0x007f('0x1b')]=function(_0x143fca){var _0x4c0ead=this;return new Promise(function(_0x27682a,_0x2901cd){return db['VoiceDialReport'][_0x007f('0x1c')](_0x143fca[_0x007f('0x1d')],{'raw':_0x143fca[_0x007f('0x1a')]?_0x143fca[_0x007f('0x1a')][_0x007f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x143fca[_0x007f('0x1a')]?_0x143fca['options'][_0x007f('0x1f')]||null:null,'attributes':_0x143fca[_0x007f('0x1a')]?_0x143fca[_0x007f('0x1a')][_0x007f('0x20')]||null:null,'limit':_0x143fca['options']?_0x143fca[_0x007f('0x1a')]['limit']||null:null})[_0x007f('0xe')](function(_0x5c270a){logger['info'](_0x007f('0x1b'),_0x143fca);logger['debug'](_0x007f('0x1b'),_0x143fca,JSON[_0x007f('0x21')](_0x5c270a));_0x27682a(_0x5c270a);})[_0x007f('0x16')](function(_0x1853b4){logger[_0x007f('0x13')](_0x007f('0x1b'),_0x1853b4['message'],_0x143fca);_0x2901cd(_0x4c0ead['error'](0x1f4,_0x1853b4[_0x007f('0x15')]));});});};