0fc14efde9f65afd600903c500e04521a185381a
[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 _0xa8f9=['then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xa8f9,0xc0));var _0x9a8f=function(_0x466df4,_0x504d6d){_0x466df4=_0x466df4-0x0;var _0xde8c6=_0xa8f9[_0x466df4];return _0xde8c6;};'use strict';var _=require(_0x9a8f('0x0'));var util=require(_0x9a8f('0x1'));var moment=require(_0x9a8f('0x2'));var BPromise=require(_0x9a8f('0x3'));var rs=require(_0x9a8f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9a8f('0x5'));var logger=require(_0x9a8f('0x6'))(_0x9a8f('0x7'));var config=require(_0x9a8f('0x8'));var jayson=require(_0x9a8f('0x9'));var client=jayson['client'][_0x9a8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f1cb8,_0x400c52,_0x42e556){return new BPromise(function(_0x85cfb1,_0x387568){return client[_0x9a8f('0xb')](_0x1f1cb8,_0x42e556)[_0x9a8f('0xc')](function(_0x38d88b){logger[_0x9a8f('0xd')](_0x9a8f('0xe'),_0x400c52,_0x9a8f('0xf'));logger[_0x9a8f('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x400c52,'request\x20sent',JSON[_0x9a8f('0x11')](_0x38d88b));if(_0x38d88b[_0x9a8f('0x12')]){if(_0x38d88b[_0x9a8f('0x12')][_0x9a8f('0x13')]===0x1f4){logger['error'](_0x9a8f('0xe'),_0x400c52,_0x38d88b['error']['message']);return _0x387568(_0x38d88b[_0x9a8f('0x12')]['message']);}logger[_0x9a8f('0x12')](_0x9a8f('0xe'),_0x400c52,_0x38d88b[_0x9a8f('0x12')][_0x9a8f('0x14')]);return _0x85cfb1(_0x38d88b[_0x9a8f('0x12')][_0x9a8f('0x14')]);}else{logger[_0x9a8f('0xd')](_0x9a8f('0xe'),_0x400c52,_0x9a8f('0xf'));_0x85cfb1(_0x38d88b[_0x9a8f('0x15')]['message']);}})['catch'](function(_0x1dc676){logger[_0x9a8f('0x12')](_0x9a8f('0xe'),_0x400c52,_0x1dc676);_0x387568(_0x1dc676);});});}exports[_0x9a8f('0x16')]=function(_0x5149e3){var _0x36022c=this;return new Promise(function(_0x599056,_0x2e2b7b){return db[_0x9a8f('0x17')][_0x9a8f('0x18')](_0x5149e3[_0x9a8f('0x19')],{'raw':_0x5149e3['options']?_0x5149e3[_0x9a8f('0x1a')][_0x9a8f('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x369ee7){logger[_0x9a8f('0xd')]('CreateVoiceDialReport',_0x5149e3);logger[_0x9a8f('0x10')](_0x9a8f('0x16'),_0x5149e3,JSON[_0x9a8f('0x11')](_0x369ee7));_0x599056(_0x369ee7);})[_0x9a8f('0x1c')](function(_0x4d6692){logger[_0x9a8f('0x12')](_0x9a8f('0x16'),_0x4d6692[_0x9a8f('0x14')],_0x5149e3);_0x2e2b7b(_0x36022c['error'](0x1f4,_0x4d6692['message']));});});};exports['UpdateVoiceDialReport']=function(_0x2ca6){var _0x47a22a=this;return new Promise(function(_0x1512bb,_0x26d5da){return db['VoiceDialReport'][_0x9a8f('0x1d')](_0x2ca6[_0x9a8f('0x19')],{'raw':_0x2ca6[_0x9a8f('0x1a')]?_0x2ca6[_0x9a8f('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ca6['options']?_0x2ca6[_0x9a8f('0x1a')][_0x9a8f('0x1e')]||null:null,'attributes':_0x2ca6[_0x9a8f('0x1a')]?_0x2ca6[_0x9a8f('0x1a')][_0x9a8f('0x1f')]||null:null,'limit':_0x2ca6[_0x9a8f('0x1a')]?_0x2ca6[_0x9a8f('0x1a')][_0x9a8f('0x20')]||null:null})['then'](function(_0x466eb5){logger[_0x9a8f('0xd')]('UpdateVoiceDialReport',_0x2ca6);logger[_0x9a8f('0x10')](_0x9a8f('0x21'),_0x2ca6,JSON[_0x9a8f('0x11')](_0x466eb5));_0x1512bb(_0x466eb5);})[_0x9a8f('0x1c')](function(_0x41aaea){logger['error'](_0x9a8f('0x21'),_0x41aaea['message'],_0x2ca6);_0x26d5da(_0x47a22a[_0x9a8f('0x12')](0x1f4,_0x41aaea[_0x9a8f('0x14')]));});});};