Built motion from commit 71df090e.|2.6.31
[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 _0xd416=['jayson/promise','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','VoiceCallReport','findAll','options','raw','where','attributes','limit','map','include','model','GetVoiceCallReport','catch','body','CreateVoiceCallReport','update','UpdateVoiceCallReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1bdd2d,_0x308db2){var _0x3f723a=function(_0xff0e6b){while(--_0xff0e6b){_0x1bdd2d['push'](_0x1bdd2d['shift']());}};_0x3f723a(++_0x308db2);}(_0xd416,0x1e2));var _0x6d41=function(_0x4bfbd5,_0x196676){_0x4bfbd5=_0x4bfbd5-0x0;var _0x332bc2=_0xd416[_0x4bfbd5];return _0x332bc2;};'use strict';var _=require(_0x6d41('0x0'));var util=require(_0x6d41('0x1'));var moment=require(_0x6d41('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d41('0x3'));var db=require(_0x6d41('0x4'))['db'];var utils=require(_0x6d41('0x5'));var logger=require('../../config/logger')(_0x6d41('0x6'));var config=require(_0x6d41('0x7'));var jayson=require(_0x6d41('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3811ca,_0x4a2bfe,_0x5de7e7){return new BPromise(function(_0x2702cb,_0x56a197){return client[_0x6d41('0x9')](_0x3811ca,_0x5de7e7)[_0x6d41('0xa')](function(_0x32b9c1){logger[_0x6d41('0xb')](_0x6d41('0xc'),_0x4a2bfe,_0x6d41('0xd'));logger[_0x6d41('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x4a2bfe,'request\x20sent',JSON[_0x6d41('0xf')](_0x32b9c1));if(_0x32b9c1[_0x6d41('0x10')]){if(_0x32b9c1[_0x6d41('0x10')]['code']===0x1f4){logger[_0x6d41('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x4a2bfe,_0x32b9c1['error'][_0x6d41('0x11')]);return _0x56a197(_0x32b9c1['error'][_0x6d41('0x11')]);}logger[_0x6d41('0x10')](_0x6d41('0xc'),_0x4a2bfe,_0x32b9c1[_0x6d41('0x10')]['message']);return _0x2702cb(_0x32b9c1['error'][_0x6d41('0x11')]);}else{logger[_0x6d41('0xb')](_0x6d41('0xc'),_0x4a2bfe,_0x6d41('0xd'));_0x2702cb(_0x32b9c1[_0x6d41('0x12')]['message']);}})['catch'](function(_0x3b7720){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x4a2bfe,_0x3b7720);_0x56a197(_0x3b7720);});});}exports['GetVoiceCallReport']=function(_0x2b0569){var _0x547d4b=this;return new Promise(function(_0x52eec9,_0x45426b){return db[_0x6d41('0x13')][_0x6d41('0x14')]({'raw':_0x2b0569[_0x6d41('0x15')]?_0x2b0569[_0x6d41('0x15')][_0x6d41('0x16')]===undefined?!![]:![]:!![],'where':_0x2b0569[_0x6d41('0x15')]?_0x2b0569[_0x6d41('0x15')][_0x6d41('0x17')]||null:null,'attributes':_0x2b0569[_0x6d41('0x15')]?_0x2b0569[_0x6d41('0x15')][_0x6d41('0x18')]||null:null,'limit':_0x2b0569[_0x6d41('0x15')]?_0x2b0569[_0x6d41('0x15')][_0x6d41('0x19')]||null:null,'include':_0x2b0569[_0x6d41('0x15')]?_0x2b0569['options']['include']?_[_0x6d41('0x1a')](_0x2b0569[_0x6d41('0x15')][_0x6d41('0x1b')],function(_0x1ea1cb){return{'model':db[_0x1ea1cb[_0x6d41('0x1c')]],'as':_0x1ea1cb['as'],'attributes':_0x1ea1cb[_0x6d41('0x18')],'include':_0x1ea1cb[_0x6d41('0x1b')]?_['map'](_0x1ea1cb['include'],function(_0x4eb186){return{'model':db[_0x4eb186['model']],'as':_0x4eb186['as'],'attributes':_0x4eb186[_0x6d41('0x18')],'include':_0x4eb186[_0x6d41('0x1b')]?_['map'](_0x4eb186['include'],function(_0x47b2aa){return{'model':db[_0x47b2aa[_0x6d41('0x1c')]],'as':_0x47b2aa['as'],'attributes':_0x47b2aa[_0x6d41('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5eced4){logger[_0x6d41('0xb')](_0x6d41('0x1d'),_0x2b0569);logger[_0x6d41('0xe')](_0x6d41('0x1d'),_0x2b0569,JSON['stringify'](_0x5eced4));_0x52eec9(_0x5eced4);})[_0x6d41('0x1e')](function(_0x2c3a51){logger['error']('GetVoiceCallReport',_0x2c3a51[_0x6d41('0x11')],_0x2b0569);_0x45426b(_0x547d4b[_0x6d41('0x10')](0x1f4,_0x2c3a51[_0x6d41('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x145bf2){var _0x3fd914=this;return new Promise(function(_0x43b11f,_0xce4723){return db['VoiceCallReport']['create'](_0x145bf2[_0x6d41('0x1f')],{'raw':_0x145bf2[_0x6d41('0x15')]?_0x145bf2[_0x6d41('0x15')][_0x6d41('0x16')]===undefined?!![]:![]:!![]})[_0x6d41('0xa')](function(_0x46f036){logger['info'](_0x6d41('0x20'),_0x145bf2);logger['debug']('CreateVoiceCallReport',_0x145bf2,JSON[_0x6d41('0xf')](_0x46f036));_0x43b11f(_0x46f036);})[_0x6d41('0x1e')](function(_0x516bb6){logger[_0x6d41('0x10')](_0x6d41('0x20'),_0x516bb6[_0x6d41('0x11')],_0x145bf2);_0xce4723(_0x3fd914[_0x6d41('0x10')](0x1f4,_0x516bb6[_0x6d41('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0xa8e4c0){var _0x28e871=this;return new Promise(function(_0x33b7e4,_0x501b1e){return db['VoiceCallReport'][_0x6d41('0x21')](_0xa8e4c0['body'],{'raw':_0xa8e4c0[_0x6d41('0x15')]?_0xa8e4c0[_0x6d41('0x15')][_0x6d41('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa8e4c0[_0x6d41('0x15')]?_0xa8e4c0['options'][_0x6d41('0x17')]||null:null,'attributes':_0xa8e4c0[_0x6d41('0x15')]?_0xa8e4c0[_0x6d41('0x15')][_0x6d41('0x18')]||null:null,'limit':_0xa8e4c0['options']?_0xa8e4c0['options'][_0x6d41('0x19')]||null:null})[_0x6d41('0xa')](function(_0x41d1d1){logger[_0x6d41('0xb')](_0x6d41('0x22'),_0xa8e4c0);logger['debug'](_0x6d41('0x22'),_0xa8e4c0,JSON[_0x6d41('0xf')](_0x41d1d1));_0x33b7e4(_0x41d1d1);})[_0x6d41('0x1e')](function(_0x1496f2){logger[_0x6d41('0x10')](_0x6d41('0x22'),_0x1496f2[_0x6d41('0x11')],_0xa8e4c0);_0x501b1e(_0x28e871[_0x6d41('0x10')](0x1f4,_0x1496f2[_0x6d41('0x11')]));});});};