Built motion from commit (unavailable).|2.0.75
[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 _0xcc82=['info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','where','attributes','limit','include','CreateVoiceCallReport','create','body','raw','debug','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0xcc82,0xc0));var _0x2cc8=function(_0x2b0f81,_0x3917f0){_0x2b0f81=_0x2b0f81-0x0;var _0x5ce74c=_0xcc82[_0x2b0f81];return _0x5ce74c;};'use strict';var _=require(_0x2cc8('0x0'));var util=require(_0x2cc8('0x1'));var moment=require(_0x2cc8('0x2'));var BPromise=require(_0x2cc8('0x3'));var rs=require(_0x2cc8('0x4'));var fs=require('fs');var db=require(_0x2cc8('0x5'))['db'];var utils=require(_0x2cc8('0x6'));var logger=require(_0x2cc8('0x7'))(_0x2cc8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2cc8('0x9')][_0x2cc8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f29f7,_0x2c2650,_0x5622f4){return new BPromise(function(_0x9b2720,_0x4ae065){return client['request'](_0x3f29f7,_0x5622f4)[_0x2cc8('0xb')](function(_0x9eccbc){logger[_0x2cc8('0xc')](_0x2cc8('0xd'),_0x2c2650,_0x2cc8('0xe'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x2c2650,_0x2cc8('0xe'),JSON[_0x2cc8('0xf')](_0x9eccbc));if(_0x9eccbc[_0x2cc8('0x10')]){if(_0x9eccbc[_0x2cc8('0x10')][_0x2cc8('0x11')]===0x1f4){logger[_0x2cc8('0x10')](_0x2cc8('0xd'),_0x2c2650,_0x9eccbc['error'][_0x2cc8('0x12')]);return _0x4ae065(_0x9eccbc[_0x2cc8('0x10')][_0x2cc8('0x12')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x2c2650,_0x9eccbc['error'][_0x2cc8('0x12')]);return _0x9b2720(_0x9eccbc[_0x2cc8('0x10')][_0x2cc8('0x12')]);}else{logger[_0x2cc8('0xc')](_0x2cc8('0xd'),_0x2c2650,_0x2cc8('0xe'));_0x9b2720(_0x9eccbc[_0x2cc8('0x13')]['message']);}})[_0x2cc8('0x14')](function(_0x104807){logger[_0x2cc8('0x10')](_0x2cc8('0xd'),_0x2c2650,_0x104807);_0x4ae065(_0x104807);});});}exports[_0x2cc8('0x15')]=function(_0x40f441){var _0x314f00=this;return new Promise(function(_0x46d958,_0x37afe5){return db[_0x2cc8('0x16')]['findAll']({'raw':_0x40f441['options']?_0x40f441[_0x2cc8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x40f441[_0x2cc8('0x17')]?_0x40f441[_0x2cc8('0x17')][_0x2cc8('0x18')]||null:null,'attributes':_0x40f441[_0x2cc8('0x17')]?_0x40f441['options'][_0x2cc8('0x19')]||null:null,'limit':_0x40f441['options']?_0x40f441['options'][_0x2cc8('0x1a')]||null:null,'include':_0x40f441[_0x2cc8('0x17')]?_0x40f441['options']['include']?_['map'](_0x40f441[_0x2cc8('0x17')]['include'],function(_0x319811){return{'model':db[_0x319811['model']],'as':_0x319811['as'],'attributes':_0x319811[_0x2cc8('0x19')],'include':_0x319811['include']?_['map'](_0x319811['include'],function(_0x3d5724){return{'model':db[_0x3d5724['model']],'as':_0x3d5724['as'],'attributes':_0x3d5724['attributes'],'include':_0x3d5724[_0x2cc8('0x1b')]?_['map'](_0x3d5724['include'],function(_0x2a4a51){return{'model':db[_0x2a4a51['model']],'as':_0x2a4a51['as'],'attributes':_0x2a4a51[_0x2cc8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2cc8('0xb')](function(_0x3a75f6){logger[_0x2cc8('0xc')]('GetVoiceCallReport',_0x40f441);logger['debug']('GetVoiceCallReport',_0x40f441,JSON[_0x2cc8('0xf')](_0x3a75f6));_0x46d958(_0x3a75f6);})[_0x2cc8('0x14')](function(_0xbf1b48){logger['error'](_0x2cc8('0x15'),_0xbf1b48[_0x2cc8('0x12')],_0x40f441);_0x37afe5(_0x314f00[_0x2cc8('0x10')](0x1f4,_0xbf1b48['message']));});});};exports[_0x2cc8('0x1c')]=function(_0x1e6a8a){var _0x2297c3=this;return new Promise(function(_0x311124,_0x257b28){return db[_0x2cc8('0x16')][_0x2cc8('0x1d')](_0x1e6a8a[_0x2cc8('0x1e')],{'raw':_0x1e6a8a['options']?_0x1e6a8a[_0x2cc8('0x17')][_0x2cc8('0x1f')]===undefined?!![]:![]:!![]})[_0x2cc8('0xb')](function(_0x3c0c05){logger['info'](_0x2cc8('0x1c'),_0x1e6a8a);logger[_0x2cc8('0x20')](_0x2cc8('0x1c'),_0x1e6a8a,JSON[_0x2cc8('0xf')](_0x3c0c05));_0x311124(_0x3c0c05);})[_0x2cc8('0x14')](function(_0x5e8c6b){logger['error'](_0x2cc8('0x1c'),_0x5e8c6b[_0x2cc8('0x12')],_0x1e6a8a);_0x257b28(_0x2297c3[_0x2cc8('0x10')](0x1f4,_0x5e8c6b[_0x2cc8('0x12')]));});});};exports[_0x2cc8('0x21')]=function(_0x28b04e){var _0x3b60df=this;return new Promise(function(_0x418b07,_0x4a5a6a){return db['VoiceCallReport']['update'](_0x28b04e[_0x2cc8('0x1e')],{'raw':_0x28b04e[_0x2cc8('0x17')]?_0x28b04e[_0x2cc8('0x17')][_0x2cc8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28b04e[_0x2cc8('0x17')]?_0x28b04e[_0x2cc8('0x17')]['where']||null:null,'attributes':_0x28b04e['options']?_0x28b04e['options']['attributes']||null:null,'limit':_0x28b04e['options']?_0x28b04e[_0x2cc8('0x17')][_0x2cc8('0x1a')]||null:null})['then'](function(_0x2e8a9c){logger[_0x2cc8('0xc')](_0x2cc8('0x21'),_0x28b04e);logger[_0x2cc8('0x20')](_0x2cc8('0x21'),_0x28b04e,JSON[_0x2cc8('0xf')](_0x2e8a9c));_0x418b07(_0x2e8a9c);})[_0x2cc8('0x14')](function(_0x166e99){logger[_0x2cc8('0x10')](_0x2cc8('0x21'),_0x166e99[_0x2cc8('0x12')],_0x28b04e);_0x4a5a6a(_0x3b60df[_0x2cc8('0x10')](0x1f4,_0x166e99['message']));});});};