Built motion from commit 67e5df37.|2.0.66
[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 _0x36f6=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','include','map','model','debug','CreateVoiceCallReport','create','body','raw','then','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x121e11,_0x1e98eb){var _0x533ef2=function(_0x2d111b){while(--_0x2d111b){_0x121e11['push'](_0x121e11['shift']());}};_0x533ef2(++_0x1e98eb);}(_0x36f6,0x159));var _0x636f=function(_0xf7f60a,_0x15f736){_0xf7f60a=_0xf7f60a-0x0;var _0x2567ad=_0x36f6[_0xf7f60a];return _0x2567ad;};'use strict';var _=require(_0x636f('0x0'));var util=require(_0x636f('0x1'));var moment=require(_0x636f('0x2'));var BPromise=require(_0x636f('0x3'));var rs=require(_0x636f('0x4'));var fs=require('fs');var db=require(_0x636f('0x5'))['db'];var utils=require(_0x636f('0x6'));var logger=require('../../config/logger')(_0x636f('0x7'));var config=require(_0x636f('0x8'));var jayson=require(_0x636f('0x9'));var client=jayson[_0x636f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42faba,_0x47e72b,_0xf1dd39){return new BPromise(function(_0x1f5eee,_0x12a812){return client[_0x636f('0xb')](_0x42faba,_0xf1dd39)['then'](function(_0x5e04fb){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x47e72b,_0x636f('0xc'));logger['debug'](_0x636f('0xd'),_0x47e72b,_0x636f('0xc'),JSON[_0x636f('0xe')](_0x5e04fb));if(_0x5e04fb[_0x636f('0xf')]){if(_0x5e04fb[_0x636f('0xf')][_0x636f('0x10')]===0x1f4){logger[_0x636f('0xf')](_0x636f('0x11'),_0x47e72b,_0x5e04fb[_0x636f('0xf')][_0x636f('0x12')]);return _0x12a812(_0x5e04fb[_0x636f('0xf')]['message']);}logger['error'](_0x636f('0x11'),_0x47e72b,_0x5e04fb[_0x636f('0xf')][_0x636f('0x12')]);return _0x1f5eee(_0x5e04fb[_0x636f('0xf')][_0x636f('0x12')]);}else{logger[_0x636f('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x47e72b,_0x636f('0xc'));_0x1f5eee(_0x5e04fb['result']['message']);}})[_0x636f('0x14')](function(_0x545fcb){logger[_0x636f('0xf')](_0x636f('0x11'),_0x47e72b,_0x545fcb);_0x12a812(_0x545fcb);});});}exports[_0x636f('0x15')]=function(_0x394df3){var _0x3ae0d0=this;return new Promise(function(_0x5a7dcb,_0x4fcdf7){return db[_0x636f('0x16')][_0x636f('0x17')]({'raw':_0x394df3[_0x636f('0x18')]?_0x394df3[_0x636f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x394df3['options']?_0x394df3['options'][_0x636f('0x19')]||null:null,'attributes':_0x394df3['options']?_0x394df3[_0x636f('0x18')][_0x636f('0x1a')]||null:null,'limit':_0x394df3[_0x636f('0x18')]?_0x394df3['options'][_0x636f('0x1b')]||null:null,'include':_0x394df3['options']?_0x394df3[_0x636f('0x18')][_0x636f('0x1c')]?_[_0x636f('0x1d')](_0x394df3[_0x636f('0x18')][_0x636f('0x1c')],function(_0x1cb370){return{'model':db[_0x1cb370[_0x636f('0x1e')]],'as':_0x1cb370['as'],'attributes':_0x1cb370[_0x636f('0x1a')],'include':_0x1cb370[_0x636f('0x1c')]?_[_0x636f('0x1d')](_0x1cb370['include'],function(_0x3a9169){return{'model':db[_0x3a9169[_0x636f('0x1e')]],'as':_0x3a9169['as'],'attributes':_0x3a9169[_0x636f('0x1a')],'include':_0x3a9169[_0x636f('0x1c')]?_[_0x636f('0x1d')](_0x3a9169[_0x636f('0x1c')],function(_0x51a6e1){return{'model':db[_0x51a6e1[_0x636f('0x1e')]],'as':_0x51a6e1['as'],'attributes':_0x51a6e1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f4956){logger['info'](_0x636f('0x15'),_0x394df3);logger[_0x636f('0x1f')]('GetVoiceCallReport',_0x394df3,JSON['stringify'](_0x5f4956));_0x5a7dcb(_0x5f4956);})[_0x636f('0x14')](function(_0x256d6e){logger[_0x636f('0xf')]('GetVoiceCallReport',_0x256d6e[_0x636f('0x12')],_0x394df3);_0x4fcdf7(_0x3ae0d0['error'](0x1f4,_0x256d6e[_0x636f('0x12')]));});});};exports[_0x636f('0x20')]=function(_0x5df947){var _0xdc6135=this;return new Promise(function(_0x16be21,_0x45957c){return db[_0x636f('0x16')][_0x636f('0x21')](_0x5df947[_0x636f('0x22')],{'raw':_0x5df947[_0x636f('0x18')]?_0x5df947[_0x636f('0x18')][_0x636f('0x23')]===undefined?!![]:![]:!![]})[_0x636f('0x24')](function(_0x140691){logger[_0x636f('0x13')](_0x636f('0x20'),_0x5df947);logger[_0x636f('0x1f')](_0x636f('0x20'),_0x5df947,JSON[_0x636f('0xe')](_0x140691));_0x16be21(_0x140691);})[_0x636f('0x14')](function(_0x2c3ef6){logger[_0x636f('0xf')](_0x636f('0x20'),_0x2c3ef6[_0x636f('0x12')],_0x5df947);_0x45957c(_0xdc6135['error'](0x1f4,_0x2c3ef6['message']));});});};exports['UpdateVoiceCallReport']=function(_0x525d83){var _0x4388a9=this;return new Promise(function(_0x3d6e00,_0x3c7be0){return db[_0x636f('0x16')][_0x636f('0x25')](_0x525d83['body'],{'raw':_0x525d83[_0x636f('0x18')]?_0x525d83[_0x636f('0x18')][_0x636f('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x525d83[_0x636f('0x18')]?_0x525d83['options'][_0x636f('0x19')]||null:null,'attributes':_0x525d83[_0x636f('0x18')]?_0x525d83[_0x636f('0x18')][_0x636f('0x1a')]||null:null,'limit':_0x525d83[_0x636f('0x18')]?_0x525d83[_0x636f('0x18')][_0x636f('0x1b')]||null:null})[_0x636f('0x24')](function(_0xf70ff){logger[_0x636f('0x13')](_0x636f('0x26'),_0x525d83);logger['debug'](_0x636f('0x26'),_0x525d83,JSON[_0x636f('0xe')](_0xf70ff));_0x3d6e00(_0xf70ff);})[_0x636f('0x14')](function(_0x17062e){logger[_0x636f('0xf')](_0x636f('0x26'),_0x17062e[_0x636f('0x12')],_0x525d83);_0x3c7be0(_0x4388a9[_0x636f('0xf')](0x1f4,_0x17062e[_0x636f('0x12')]));});});};