a815e21cc7da267bdc7bba5e4101cd30c5cfb7d4
[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 _0x81f1=['request\x20sent','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x81f1,0x18b));var _0x181f=function(_0x4b7bdf,_0x2be2d1){_0x4b7bdf=_0x4b7bdf-0x0;var _0x3fce2f=_0x81f1[_0x4b7bdf];return _0x3fce2f;};'use strict';var _=require(_0x181f('0x0'));var util=require(_0x181f('0x1'));var moment=require(_0x181f('0x2'));var BPromise=require(_0x181f('0x3'));var rs=require(_0x181f('0x4'));var fs=require('fs');var Redis=require(_0x181f('0x5'));var db=require(_0x181f('0x6'))['db'];var utils=require(_0x181f('0x7'));var logger=require(_0x181f('0x8'))(_0x181f('0x9'));var config=require(_0x181f('0xa'));var jayson=require(_0x181f('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25130c,_0x18211a,_0x51d0b4){return new BPromise(function(_0x4bf461,_0x2bd29a){return client[_0x181f('0xc')](_0x25130c,_0x51d0b4)[_0x181f('0xd')](function(_0x273e25){logger['info'](_0x181f('0xe'),_0x18211a,'request\x20sent');logger[_0x181f('0xf')](_0x181f('0x10'),_0x18211a,'request\x20sent',JSON[_0x181f('0x11')](_0x273e25));if(_0x273e25[_0x181f('0x12')]){if(_0x273e25[_0x181f('0x12')]['code']===0x1f4){logger[_0x181f('0x12')](_0x181f('0xe'),_0x18211a,_0x273e25[_0x181f('0x12')][_0x181f('0x13')]);return _0x2bd29a(_0x273e25[_0x181f('0x12')]['message']);}logger[_0x181f('0x12')](_0x181f('0xe'),_0x18211a,_0x273e25['error']['message']);return _0x4bf461(_0x273e25[_0x181f('0x12')][_0x181f('0x13')]);}else{logger[_0x181f('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x18211a,_0x181f('0x15'));_0x4bf461(_0x273e25[_0x181f('0x16')][_0x181f('0x13')]);}})[_0x181f('0x17')](function(_0x41b3de){logger[_0x181f('0x12')](_0x181f('0xe'),_0x18211a,_0x41b3de);_0x2bd29a(_0x41b3de);});});}exports[_0x181f('0x18')]=function(_0x4e4b56){var _0x43ccec=this;return new Promise(function(_0x214aa5,_0x55366c){return db[_0x181f('0x19')][_0x181f('0x1a')](_0x4e4b56[_0x181f('0x1b')],{'raw':_0x4e4b56[_0x181f('0x1c')]?_0x4e4b56[_0x181f('0x1c')][_0x181f('0x1d')]===undefined?!![]:![]:!![]})[_0x181f('0xd')](function(_0x2adfbd){logger[_0x181f('0x14')]('CreateVoiceDialReport',_0x4e4b56);logger[_0x181f('0xf')]('CreateVoiceDialReport',_0x4e4b56,JSON['stringify'](_0x2adfbd));_0x214aa5(_0x2adfbd);})[_0x181f('0x17')](function(_0x199f56){logger['error'](_0x181f('0x18'),_0x199f56[_0x181f('0x13')],_0x4e4b56);_0x55366c(_0x43ccec[_0x181f('0x12')](0x1f4,_0x199f56[_0x181f('0x13')]));});});};exports[_0x181f('0x1e')]=function(_0x4af1a6){var _0x4b5dce=this;return new Promise(function(_0x221cea,_0x415369){return db[_0x181f('0x19')]['update'](_0x4af1a6[_0x181f('0x1b')],{'raw':_0x4af1a6[_0x181f('0x1c')]?_0x4af1a6[_0x181f('0x1c')][_0x181f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4af1a6['options']?_0x4af1a6['options'][_0x181f('0x1f')]||null:null,'attributes':_0x4af1a6[_0x181f('0x1c')]?_0x4af1a6[_0x181f('0x1c')]['attributes']||null:null,'limit':_0x4af1a6[_0x181f('0x1c')]?_0x4af1a6[_0x181f('0x1c')]['limit']||null:null})['then'](function(_0x3069e9){logger[_0x181f('0x14')](_0x181f('0x1e'),_0x4af1a6);logger[_0x181f('0xf')](_0x181f('0x1e'),_0x4af1a6,JSON[_0x181f('0x11')](_0x3069e9));_0x221cea(_0x3069e9);})[_0x181f('0x17')](function(_0x4d2fd4){logger['error'](_0x181f('0x1e'),_0x4d2fd4[_0x181f('0x13')],_0x4af1a6);_0x415369(_0x4b5dce[_0x181f('0x12')](0x1f4,_0x4d2fd4['message']));});});};