Built motion from commit 10af8726.|2.6.34
[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 _0x3375=['include','model','attributes','map','then','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','VoiceCallReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport','findAll','options','where'];(function(_0x4cd135,_0x272b52){var _0x645f98=function(_0xf417a0){while(--_0xf417a0){_0x4cd135['push'](_0x4cd135['shift']());}};_0x645f98(++_0x272b52);}(_0x3375,0x16c));var _0x5337=function(_0x4df75b,_0x359658){_0x4df75b=_0x4df75b-0x0;var _0x1f5e52=_0x3375[_0x4df75b];return _0x1f5e52;};'use strict';var _=require(_0x5337('0x0'));var util=require(_0x5337('0x1'));var moment=require(_0x5337('0x2'));var BPromise=require(_0x5337('0x3'));var rs=require(_0x5337('0x4'));var fs=require('fs');var Redis=require(_0x5337('0x5'));var db=require(_0x5337('0x6'))['db'];var utils=require(_0x5337('0x7'));var logger=require(_0x5337('0x8'))(_0x5337('0x9'));var config=require('../../config/environment');var jayson=require(_0x5337('0xa'));var client=jayson[_0x5337('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22ab9c,_0x172534,_0x369531){return new BPromise(function(_0x16d428,_0x545f14){return client['request'](_0x22ab9c,_0x369531)['then'](function(_0x40c42e){logger[_0x5337('0xc')](_0x5337('0xd'),_0x172534,_0x5337('0xe'));logger[_0x5337('0xf')](_0x5337('0x10'),_0x172534,'request\x20sent',JSON[_0x5337('0x11')](_0x40c42e));if(_0x40c42e['error']){if(_0x40c42e[_0x5337('0x12')][_0x5337('0x13')]===0x1f4){logger[_0x5337('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x172534,_0x40c42e[_0x5337('0x12')][_0x5337('0x14')]);return _0x545f14(_0x40c42e['error'][_0x5337('0x14')]);}logger[_0x5337('0x12')](_0x5337('0xd'),_0x172534,_0x40c42e['error']['message']);return _0x16d428(_0x40c42e[_0x5337('0x12')]['message']);}else{logger[_0x5337('0xc')](_0x5337('0xd'),_0x172534,_0x5337('0xe'));_0x16d428(_0x40c42e['result'][_0x5337('0x14')]);}})[_0x5337('0x15')](function(_0x3c6aa1){logger[_0x5337('0x12')](_0x5337('0xd'),_0x172534,_0x3c6aa1);_0x545f14(_0x3c6aa1);});});}exports[_0x5337('0x16')]=function(_0xc1a7b4){var _0x182a3c=this;return new Promise(function(_0x1d29b4,_0x1e8f66){return db['VoiceCallReport'][_0x5337('0x17')]({'raw':_0xc1a7b4[_0x5337('0x18')]?_0xc1a7b4[_0x5337('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xc1a7b4[_0x5337('0x18')]?_0xc1a7b4['options'][_0x5337('0x19')]||null:null,'attributes':_0xc1a7b4['options']?_0xc1a7b4[_0x5337('0x18')]['attributes']||null:null,'limit':_0xc1a7b4[_0x5337('0x18')]?_0xc1a7b4['options']['limit']||null:null,'include':_0xc1a7b4[_0x5337('0x18')]?_0xc1a7b4[_0x5337('0x18')][_0x5337('0x1a')]?_['map'](_0xc1a7b4['options'][_0x5337('0x1a')],function(_0x65269e){return{'model':db[_0x65269e[_0x5337('0x1b')]],'as':_0x65269e['as'],'attributes':_0x65269e[_0x5337('0x1c')],'include':_0x65269e[_0x5337('0x1a')]?_[_0x5337('0x1d')](_0x65269e['include'],function(_0x207ce1){return{'model':db[_0x207ce1[_0x5337('0x1b')]],'as':_0x207ce1['as'],'attributes':_0x207ce1[_0x5337('0x1c')],'include':_0x207ce1[_0x5337('0x1a')]?_[_0x5337('0x1d')](_0x207ce1[_0x5337('0x1a')],function(_0xa1861){return{'model':db[_0xa1861[_0x5337('0x1b')]],'as':_0xa1861['as'],'attributes':_0xa1861[_0x5337('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5337('0x1e')](function(_0x328d41){logger['info'](_0x5337('0x16'),_0xc1a7b4);logger['debug'](_0x5337('0x16'),_0xc1a7b4,JSON['stringify'](_0x328d41));_0x1d29b4(_0x328d41);})[_0x5337('0x15')](function(_0x49d88e){logger[_0x5337('0x12')]('GetVoiceCallReport',_0x49d88e['message'],_0xc1a7b4);_0x1e8f66(_0x182a3c[_0x5337('0x12')](0x1f4,_0x49d88e[_0x5337('0x14')]));});});};exports[_0x5337('0x1f')]=function(_0x49e3a7){var _0x4ac455=this;return new Promise(function(_0x2a131b,_0x44dce8){return db['VoiceCallReport'][_0x5337('0x20')](_0x49e3a7[_0x5337('0x21')],{'raw':_0x49e3a7[_0x5337('0x18')]?_0x49e3a7[_0x5337('0x18')][_0x5337('0x22')]===undefined?!![]:![]:!![]})[_0x5337('0x1e')](function(_0x575b2a){logger[_0x5337('0xc')]('CreateVoiceCallReport',_0x49e3a7);logger['debug'](_0x5337('0x1f'),_0x49e3a7,JSON[_0x5337('0x11')](_0x575b2a));_0x2a131b(_0x575b2a);})[_0x5337('0x15')](function(_0x4fc3d9){logger[_0x5337('0x12')](_0x5337('0x1f'),_0x4fc3d9['message'],_0x49e3a7);_0x44dce8(_0x4ac455[_0x5337('0x12')](0x1f4,_0x4fc3d9[_0x5337('0x14')]));});});};exports[_0x5337('0x23')]=function(_0x1e1801){var _0x45575c=this;return new Promise(function(_0x498d7c,_0x28ce90){return db[_0x5337('0x24')][_0x5337('0x25')](_0x1e1801[_0x5337('0x21')],{'raw':_0x1e1801['options']?_0x1e1801['options'][_0x5337('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e1801[_0x5337('0x18')]?_0x1e1801[_0x5337('0x18')][_0x5337('0x19')]||null:null,'attributes':_0x1e1801['options']?_0x1e1801[_0x5337('0x18')]['attributes']||null:null,'limit':_0x1e1801['options']?_0x1e1801[_0x5337('0x18')][_0x5337('0x26')]||null:null})[_0x5337('0x1e')](function(_0x436962){logger[_0x5337('0xc')](_0x5337('0x23'),_0x1e1801);logger[_0x5337('0xf')](_0x5337('0x23'),_0x1e1801,JSON[_0x5337('0x11')](_0x436962));_0x498d7c(_0x436962);})['catch'](function(_0x1156c1){logger[_0x5337('0x12')](_0x5337('0x23'),_0x1156c1[_0x5337('0x14')],_0x1e1801);_0x28ce90(_0x45575c[_0x5337('0x12')](0x1f4,_0x1156c1['message']));});});};