Built motion from commit (unavailable).|2.0.79
[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 _0xc89c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','include','model','map','then','CreateVoiceCallReport','create','catch','UpdateVoiceCallReport','update','body','limit','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x20fa4e,_0x35a377){var _0x488944=function(_0xa2a01b){while(--_0xa2a01b){_0x20fa4e['push'](_0x20fa4e['shift']());}};_0x488944(++_0x35a377);}(_0xc89c,0xe5));var _0xcc89=function(_0x74fbe4,_0x1a7e0d){_0x74fbe4=_0x74fbe4-0x0;var _0x55fe41=_0xc89c[_0x74fbe4];return _0x55fe41;};'use strict';var _=require(_0xcc89('0x0'));var util=require('util');var moment=require(_0xcc89('0x1'));var BPromise=require(_0xcc89('0x2'));var rs=require(_0xcc89('0x3'));var fs=require('fs');var db=require(_0xcc89('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc89('0x5'))(_0xcc89('0x6'));var config=require(_0xcc89('0x7'));var jayson=require(_0xcc89('0x8'));var client=jayson[_0xcc89('0x9')][_0xcc89('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35936c,_0xbbd671,_0x153994){return new BPromise(function(_0x4e694a,_0x641029){return client[_0xcc89('0xb')](_0x35936c,_0x153994)['then'](function(_0xb13db0){logger[_0xcc89('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0xbbd671,_0xcc89('0xd'));logger[_0xcc89('0xe')](_0xcc89('0xf'),_0xbbd671,_0xcc89('0xd'),JSON[_0xcc89('0x10')](_0xb13db0));if(_0xb13db0[_0xcc89('0x11')]){if(_0xb13db0[_0xcc89('0x11')][_0xcc89('0x12')]===0x1f4){logger[_0xcc89('0x11')](_0xcc89('0x13'),_0xbbd671,_0xb13db0['error']['message']);return _0x641029(_0xb13db0['error'][_0xcc89('0x14')]);}logger['error'](_0xcc89('0x13'),_0xbbd671,_0xb13db0[_0xcc89('0x11')][_0xcc89('0x14')]);return _0x4e694a(_0xb13db0[_0xcc89('0x11')][_0xcc89('0x14')]);}else{logger[_0xcc89('0xc')](_0xcc89('0x13'),_0xbbd671,_0xcc89('0xd'));_0x4e694a(_0xb13db0[_0xcc89('0x15')]['message']);}})['catch'](function(_0x3f11f5){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0xbbd671,_0x3f11f5);_0x641029(_0x3f11f5);});});}exports[_0xcc89('0x16')]=function(_0x1ffaf1){var _0x4a8291=this;return new Promise(function(_0x1e6558,_0x4bf671){return db[_0xcc89('0x17')]['findAll']({'raw':_0x1ffaf1[_0xcc89('0x18')]?_0x1ffaf1[_0xcc89('0x18')][_0xcc89('0x19')]===undefined?!![]:![]:!![],'where':_0x1ffaf1[_0xcc89('0x18')]?_0x1ffaf1[_0xcc89('0x18')][_0xcc89('0x1a')]||null:null,'attributes':_0x1ffaf1[_0xcc89('0x18')]?_0x1ffaf1['options'][_0xcc89('0x1b')]||null:null,'limit':_0x1ffaf1[_0xcc89('0x18')]?_0x1ffaf1[_0xcc89('0x18')]['limit']||null:null,'include':_0x1ffaf1['options']?_0x1ffaf1[_0xcc89('0x18')][_0xcc89('0x1c')]?_['map'](_0x1ffaf1[_0xcc89('0x18')][_0xcc89('0x1c')],function(_0x513416){return{'model':db[_0x513416[_0xcc89('0x1d')]],'as':_0x513416['as'],'attributes':_0x513416[_0xcc89('0x1b')],'include':_0x513416[_0xcc89('0x1c')]?_[_0xcc89('0x1e')](_0x513416[_0xcc89('0x1c')],function(_0x2855f1){return{'model':db[_0x2855f1[_0xcc89('0x1d')]],'as':_0x2855f1['as'],'attributes':_0x2855f1[_0xcc89('0x1b')],'include':_0x2855f1[_0xcc89('0x1c')]?_[_0xcc89('0x1e')](_0x2855f1[_0xcc89('0x1c')],function(_0x457455){return{'model':db[_0x457455[_0xcc89('0x1d')]],'as':_0x457455['as'],'attributes':_0x457455[_0xcc89('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcc89('0x1f')](function(_0x53e849){logger[_0xcc89('0xc')](_0xcc89('0x16'),_0x1ffaf1);logger[_0xcc89('0xe')]('GetVoiceCallReport',_0x1ffaf1,JSON[_0xcc89('0x10')](_0x53e849));_0x1e6558(_0x53e849);})['catch'](function(_0x3058fd){logger[_0xcc89('0x11')](_0xcc89('0x16'),_0x3058fd['message'],_0x1ffaf1);_0x4bf671(_0x4a8291[_0xcc89('0x11')](0x1f4,_0x3058fd[_0xcc89('0x14')]));});});};exports[_0xcc89('0x20')]=function(_0x286610){var _0x816fdb=this;return new Promise(function(_0x62fe27,_0x170993){return db['VoiceCallReport'][_0xcc89('0x21')](_0x286610['body'],{'raw':_0x286610[_0xcc89('0x18')]?_0x286610['options']['raw']===undefined?!![]:![]:!![]})[_0xcc89('0x1f')](function(_0x3d5588){logger[_0xcc89('0xc')](_0xcc89('0x20'),_0x286610);logger['debug']('CreateVoiceCallReport',_0x286610,JSON[_0xcc89('0x10')](_0x3d5588));_0x62fe27(_0x3d5588);})[_0xcc89('0x22')](function(_0x41d8f4){logger['error'](_0xcc89('0x20'),_0x41d8f4['message'],_0x286610);_0x170993(_0x816fdb[_0xcc89('0x11')](0x1f4,_0x41d8f4['message']));});});};exports[_0xcc89('0x23')]=function(_0x510b35){var _0x5ad38f=this;return new Promise(function(_0x28f702,_0x739848){return db['VoiceCallReport'][_0xcc89('0x24')](_0x510b35[_0xcc89('0x25')],{'raw':_0x510b35[_0xcc89('0x18')]?_0x510b35['options'][_0xcc89('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x510b35[_0xcc89('0x18')]?_0x510b35[_0xcc89('0x18')][_0xcc89('0x1a')]||null:null,'attributes':_0x510b35[_0xcc89('0x18')]?_0x510b35[_0xcc89('0x18')][_0xcc89('0x1b')]||null:null,'limit':_0x510b35[_0xcc89('0x18')]?_0x510b35['options'][_0xcc89('0x26')]||null:null})[_0xcc89('0x1f')](function(_0x31c4e7){logger[_0xcc89('0xc')]('UpdateVoiceCallReport',_0x510b35);logger[_0xcc89('0xe')](_0xcc89('0x23'),_0x510b35,JSON[_0xcc89('0x10')](_0x31c4e7));_0x28f702(_0x31c4e7);})[_0xcc89('0x22')](function(_0x18fcc0){logger[_0xcc89('0x11')](_0xcc89('0x23'),_0x18fcc0[_0xcc89('0x14')],_0x510b35);_0x739848(_0x5ad38f[_0xcc89('0x11')](0x1f4,_0x18fcc0[_0xcc89('0x14')]));});});};