bb1ac58dcd799c0376db1a4c290c5616e3682407
[motion2.git] / server / api / voiceCallReport / voiceCallReport.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 _0xa642=['result','catch','GetVoiceCallReport','findAll','options','where','attributes','limit','include','model','map','info','CreateVoiceCallReport','VoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa642,0x14c));var _0x2a64=function(_0xb875ee,_0x583042){_0xb875ee=_0xb875ee-0x0;var _0x4c7f3a=_0xa642[_0xb875ee];return _0x4c7f3a;};'use strict';var _=require(_0x2a64('0x0'));var util=require(_0x2a64('0x1'));var moment=require(_0x2a64('0x2'));var BPromise=require(_0x2a64('0x3'));var rs=require(_0x2a64('0x4'));var fs=require('fs');var Redis=require(_0x2a64('0x5'));var db=require(_0x2a64('0x6'))['db'];var utils=require(_0x2a64('0x7'));var logger=require('../../config/logger')(_0x2a64('0x8'));var config=require(_0x2a64('0x9'));var jayson=require(_0x2a64('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1990f9,_0x353f01,_0x57193c){return new BPromise(function(_0x169955,_0x4f9dc1){return client[_0x2a64('0xb')](_0x1990f9,_0x57193c)[_0x2a64('0xc')](function(_0x2312b0){logger['info'](_0x2a64('0xd'),_0x353f01,'request\x20sent');logger[_0x2a64('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x353f01,_0x2a64('0xf'),JSON['stringify'](_0x2312b0));if(_0x2312b0['error']){if(_0x2312b0[_0x2a64('0x10')][_0x2a64('0x11')]===0x1f4){logger[_0x2a64('0x10')](_0x2a64('0xd'),_0x353f01,_0x2312b0['error'][_0x2a64('0x12')]);return _0x4f9dc1(_0x2312b0[_0x2a64('0x10')][_0x2a64('0x12')]);}logger['error'](_0x2a64('0xd'),_0x353f01,_0x2312b0['error'][_0x2a64('0x12')]);return _0x169955(_0x2312b0['error'][_0x2a64('0x12')]);}else{logger['info'](_0x2a64('0xd'),_0x353f01,_0x2a64('0xf'));_0x169955(_0x2312b0[_0x2a64('0x13')][_0x2a64('0x12')]);}})[_0x2a64('0x14')](function(_0x28dc4a){logger[_0x2a64('0x10')](_0x2a64('0xd'),_0x353f01,_0x28dc4a);_0x4f9dc1(_0x28dc4a);});});}exports[_0x2a64('0x15')]=function(_0x4fb0b0){var _0x1f78c4=this;return new Promise(function(_0x43e256,_0x2c8b1e){return db['VoiceCallReport'][_0x2a64('0x16')]({'raw':_0x4fb0b0[_0x2a64('0x17')]?_0x4fb0b0[_0x2a64('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4fb0b0[_0x2a64('0x17')]?_0x4fb0b0[_0x2a64('0x17')][_0x2a64('0x18')]||null:null,'attributes':_0x4fb0b0[_0x2a64('0x17')]?_0x4fb0b0[_0x2a64('0x17')][_0x2a64('0x19')]||null:null,'limit':_0x4fb0b0[_0x2a64('0x17')]?_0x4fb0b0[_0x2a64('0x17')][_0x2a64('0x1a')]||null:null,'include':_0x4fb0b0[_0x2a64('0x17')]?_0x4fb0b0['options'][_0x2a64('0x1b')]?_['map'](_0x4fb0b0[_0x2a64('0x17')][_0x2a64('0x1b')],function(_0x4dc6ef){return{'model':db[_0x4dc6ef[_0x2a64('0x1c')]],'as':_0x4dc6ef['as'],'attributes':_0x4dc6ef[_0x2a64('0x19')],'include':_0x4dc6ef[_0x2a64('0x1b')]?_['map'](_0x4dc6ef[_0x2a64('0x1b')],function(_0x114f06){return{'model':db[_0x114f06[_0x2a64('0x1c')]],'as':_0x114f06['as'],'attributes':_0x114f06[_0x2a64('0x19')],'include':_0x114f06[_0x2a64('0x1b')]?_[_0x2a64('0x1d')](_0x114f06[_0x2a64('0x1b')],function(_0x52d81e){return{'model':db[_0x52d81e[_0x2a64('0x1c')]],'as':_0x52d81e['as'],'attributes':_0x52d81e[_0x2a64('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2a64('0xc')](function(_0x4ea294){logger[_0x2a64('0x1e')](_0x2a64('0x15'),_0x4fb0b0);logger[_0x2a64('0xe')]('GetVoiceCallReport',_0x4fb0b0,JSON['stringify'](_0x4ea294));_0x43e256(_0x4ea294);})[_0x2a64('0x14')](function(_0x21ebdd){logger['error'](_0x2a64('0x15'),_0x21ebdd[_0x2a64('0x12')],_0x4fb0b0);_0x2c8b1e(_0x1f78c4['error'](0x1f4,_0x21ebdd[_0x2a64('0x12')]));});});};exports[_0x2a64('0x1f')]=function(_0x55205c){var _0x351ff8=this;return new Promise(function(_0x113b0b,_0x5ea231){return db[_0x2a64('0x20')][_0x2a64('0x21')](_0x55205c[_0x2a64('0x22')],{'raw':_0x55205c['options']?_0x55205c['options'][_0x2a64('0x23')]===undefined?!![]:![]:!![]})[_0x2a64('0xc')](function(_0x419494){logger[_0x2a64('0x1e')]('CreateVoiceCallReport',_0x55205c);logger[_0x2a64('0xe')](_0x2a64('0x1f'),_0x55205c,JSON['stringify'](_0x419494));_0x113b0b(_0x419494);})[_0x2a64('0x14')](function(_0x308d1f){logger[_0x2a64('0x10')](_0x2a64('0x1f'),_0x308d1f[_0x2a64('0x12')],_0x55205c);_0x5ea231(_0x351ff8[_0x2a64('0x10')](0x1f4,_0x308d1f['message']));});});};exports[_0x2a64('0x24')]=function(_0x37fb70){var _0x57acc7=this;return new Promise(function(_0x2833e5,_0x281fe0){return db[_0x2a64('0x20')][_0x2a64('0x25')](_0x37fb70[_0x2a64('0x22')],{'raw':_0x37fb70['options']?_0x37fb70[_0x2a64('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37fb70[_0x2a64('0x17')]?_0x37fb70[_0x2a64('0x17')][_0x2a64('0x18')]||null:null,'attributes':_0x37fb70[_0x2a64('0x17')]?_0x37fb70[_0x2a64('0x17')][_0x2a64('0x19')]||null:null,'limit':_0x37fb70[_0x2a64('0x17')]?_0x37fb70[_0x2a64('0x17')][_0x2a64('0x1a')]||null:null})['then'](function(_0x372b7d){logger[_0x2a64('0x1e')](_0x2a64('0x24'),_0x37fb70);logger[_0x2a64('0xe')](_0x2a64('0x24'),_0x37fb70,JSON[_0x2a64('0x26')](_0x372b7d));_0x2833e5(_0x372b7d);})[_0x2a64('0x14')](function(_0x2361a3){logger[_0x2a64('0x10')](_0x2a64('0x24'),_0x2361a3[_0x2a64('0x12')],_0x37fb70);_0x281fe0(_0x57acc7[_0x2a64('0x10')](0x1f4,_0x2361a3[_0x2a64('0x12')]));});});};