Built motion from commit (unavailable).|2.3.0
[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 _0x80b2=['rpc','../../config/environment','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetVoiceCallReport','debug','stringify','CreateVoiceCallReport','VoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0x80b2,0xb6));var _0x280b=function(_0xc8dde6,_0x2ed4eb){_0xc8dde6=_0xc8dde6-0x0;var _0x3f20df=_0x80b2[_0xc8dde6];return _0x3f20df;};'use strict';var _=require(_0x280b('0x0'));var util=require('util');var moment=require(_0x280b('0x1'));var BPromise=require(_0x280b('0x2'));var rs=require(_0x280b('0x3'));var fs=require('fs');var Redis=require(_0x280b('0x4'));var db=require(_0x280b('0x5'))['db'];var utils=require(_0x280b('0x6'));var logger=require(_0x280b('0x7'))(_0x280b('0x8'));var config=require(_0x280b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x280b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e2387,_0xcaaa3c,_0xe1509f){return new BPromise(function(_0x3b3029,_0x61a0bb){return client[_0x280b('0xb')](_0x1e2387,_0xe1509f)[_0x280b('0xc')](function(_0x1c2dc2){logger[_0x280b('0xd')](_0x280b('0xe'),_0xcaaa3c,_0x280b('0xf'));logger['debug'](_0x280b('0x10'),_0xcaaa3c,'request\x20sent',JSON['stringify'](_0x1c2dc2));if(_0x1c2dc2['error']){if(_0x1c2dc2[_0x280b('0x11')]['code']===0x1f4){logger[_0x280b('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0xcaaa3c,_0x1c2dc2['error']['message']);return _0x61a0bb(_0x1c2dc2[_0x280b('0x11')][_0x280b('0x12')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0xcaaa3c,_0x1c2dc2[_0x280b('0x11')]['message']);return _0x3b3029(_0x1c2dc2['error'][_0x280b('0x12')]);}else{logger[_0x280b('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0xcaaa3c,_0x280b('0xf'));_0x3b3029(_0x1c2dc2[_0x280b('0x13')][_0x280b('0x12')]);}})[_0x280b('0x14')](function(_0x3afd72){logger[_0x280b('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0xcaaa3c,_0x3afd72);_0x61a0bb(_0x3afd72);});});}exports['GetVoiceCallReport']=function(_0x10e21e){var _0x169e2b=this;return new Promise(function(_0x35e447,_0x36a75c){return db['VoiceCallReport'][_0x280b('0x15')]({'raw':_0x10e21e[_0x280b('0x16')]?_0x10e21e[_0x280b('0x16')][_0x280b('0x17')]===undefined?!![]:![]:!![],'where':_0x10e21e[_0x280b('0x16')]?_0x10e21e[_0x280b('0x16')][_0x280b('0x18')]||null:null,'attributes':_0x10e21e[_0x280b('0x16')]?_0x10e21e[_0x280b('0x16')][_0x280b('0x19')]||null:null,'limit':_0x10e21e['options']?_0x10e21e[_0x280b('0x16')]['limit']||null:null,'include':_0x10e21e[_0x280b('0x16')]?_0x10e21e['options'][_0x280b('0x1a')]?_['map'](_0x10e21e[_0x280b('0x16')]['include'],function(_0x24396c){return{'model':db[_0x24396c['model']],'as':_0x24396c['as'],'attributes':_0x24396c[_0x280b('0x19')],'include':_0x24396c['include']?_[_0x280b('0x1b')](_0x24396c[_0x280b('0x1a')],function(_0x375588){return{'model':db[_0x375588[_0x280b('0x1c')]],'as':_0x375588['as'],'attributes':_0x375588[_0x280b('0x19')],'include':_0x375588[_0x280b('0x1a')]?_['map'](_0x375588[_0x280b('0x1a')],function(_0x47d143){return{'model':db[_0x47d143[_0x280b('0x1c')]],'as':_0x47d143['as'],'attributes':_0x47d143[_0x280b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x280b('0xc')](function(_0x1fd9a6){logger['info'](_0x280b('0x1d'),_0x10e21e);logger[_0x280b('0x1e')](_0x280b('0x1d'),_0x10e21e,JSON[_0x280b('0x1f')](_0x1fd9a6));_0x35e447(_0x1fd9a6);})[_0x280b('0x14')](function(_0x5b8154){logger[_0x280b('0x11')]('GetVoiceCallReport',_0x5b8154[_0x280b('0x12')],_0x10e21e);_0x36a75c(_0x169e2b[_0x280b('0x11')](0x1f4,_0x5b8154[_0x280b('0x12')]));});});};exports[_0x280b('0x20')]=function(_0x47e0c7){var _0x3645a0=this;return new Promise(function(_0x48b011,_0x47dd92){return db[_0x280b('0x21')][_0x280b('0x22')](_0x47e0c7[_0x280b('0x23')],{'raw':_0x47e0c7[_0x280b('0x16')]?_0x47e0c7[_0x280b('0x16')][_0x280b('0x17')]===undefined?!![]:![]:!![]})[_0x280b('0xc')](function(_0x267eb3){logger[_0x280b('0xd')](_0x280b('0x20'),_0x47e0c7);logger[_0x280b('0x1e')](_0x280b('0x20'),_0x47e0c7,JSON[_0x280b('0x1f')](_0x267eb3));_0x48b011(_0x267eb3);})[_0x280b('0x14')](function(_0x4b5a9e){logger[_0x280b('0x11')](_0x280b('0x20'),_0x4b5a9e['message'],_0x47e0c7);_0x47dd92(_0x3645a0[_0x280b('0x11')](0x1f4,_0x4b5a9e[_0x280b('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x35594b){var _0x1cd155=this;return new Promise(function(_0xa92eca,_0x41164b){return db[_0x280b('0x21')][_0x280b('0x24')](_0x35594b['body'],{'raw':_0x35594b['options']?_0x35594b[_0x280b('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35594b[_0x280b('0x16')]?_0x35594b[_0x280b('0x16')][_0x280b('0x18')]||null:null,'attributes':_0x35594b[_0x280b('0x16')]?_0x35594b[_0x280b('0x16')][_0x280b('0x19')]||null:null,'limit':_0x35594b[_0x280b('0x16')]?_0x35594b[_0x280b('0x16')]['limit']||null:null})[_0x280b('0xc')](function(_0x531541){logger[_0x280b('0xd')](_0x280b('0x25'),_0x35594b);logger['debug'](_0x280b('0x25'),_0x35594b,JSON[_0x280b('0x1f')](_0x531541));_0xa92eca(_0x531541);})['catch'](function(_0x503dc2){logger[_0x280b('0x11')](_0x280b('0x25'),_0x503dc2[_0x280b('0x12')],_0x35594b);_0x41164b(_0x1cd155[_0x280b('0x11')](0x1f4,_0x503dc2[_0x280b('0x12')]));});});};