Built motion from commit 39adb707.|2.6.14
[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 _0x599b=['../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','limit','include','map','model','attributes','then','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','where','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x5972e6,_0x3f11ca){var _0x36e118=function(_0x1c3dab){while(--_0x1c3dab){_0x5972e6['push'](_0x5972e6['shift']());}};_0x36e118(++_0x3f11ca);}(_0x599b,0xfe));var _0xb599=function(_0x1a5e8d,_0x316177){_0x1a5e8d=_0x1a5e8d-0x0;var _0xac4865=_0x599b[_0x1a5e8d];return _0xac4865;};'use strict';var _=require(_0xb599('0x0'));var util=require(_0xb599('0x1'));var moment=require('moment');var BPromise=require(_0xb599('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb599('0x3'))['db'];var utils=require(_0xb599('0x4'));var logger=require(_0xb599('0x5'))(_0xb599('0x6'));var config=require(_0xb599('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb599('0x8')][_0xb599('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a6b1b,_0x3c9942,_0x32fa8f){return new BPromise(function(_0x33beee,_0x1cfa25){return client[_0xb599('0xa')](_0x3a6b1b,_0x32fa8f)['then'](function(_0xfd7181){logger[_0xb599('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x3c9942,_0xb599('0xc'));logger['debug'](_0xb599('0xd'),_0x3c9942,'request\x20sent',JSON[_0xb599('0xe')](_0xfd7181));if(_0xfd7181[_0xb599('0xf')]){if(_0xfd7181[_0xb599('0xf')][_0xb599('0x10')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3c9942,_0xfd7181[_0xb599('0xf')][_0xb599('0x11')]);return _0x1cfa25(_0xfd7181[_0xb599('0xf')][_0xb599('0x11')]);}logger[_0xb599('0xf')](_0xb599('0x12'),_0x3c9942,_0xfd7181[_0xb599('0xf')][_0xb599('0x11')]);return _0x33beee(_0xfd7181[_0xb599('0xf')][_0xb599('0x11')]);}else{logger[_0xb599('0xb')](_0xb599('0x12'),_0x3c9942,_0xb599('0xc'));_0x33beee(_0xfd7181['result']['message']);}})[_0xb599('0x13')](function(_0x27455b){logger[_0xb599('0xf')](_0xb599('0x12'),_0x3c9942,_0x27455b);_0x1cfa25(_0x27455b);});});}exports[_0xb599('0x14')]=function(_0x33cc95){var _0x4b5b94=this;return new Promise(function(_0x586db4,_0x36d9fc){return db[_0xb599('0x15')][_0xb599('0x16')]({'raw':_0x33cc95[_0xb599('0x17')]?_0x33cc95[_0xb599('0x17')][_0xb599('0x18')]===undefined?!![]:![]:!![],'where':_0x33cc95[_0xb599('0x17')]?_0x33cc95['options']['where']||null:null,'attributes':_0x33cc95[_0xb599('0x17')]?_0x33cc95[_0xb599('0x17')]['attributes']||null:null,'limit':_0x33cc95['options']?_0x33cc95[_0xb599('0x17')][_0xb599('0x19')]||null:null,'include':_0x33cc95[_0xb599('0x17')]?_0x33cc95['options'][_0xb599('0x1a')]?_[_0xb599('0x1b')](_0x33cc95[_0xb599('0x17')][_0xb599('0x1a')],function(_0x32fb09){return{'model':db[_0x32fb09[_0xb599('0x1c')]],'as':_0x32fb09['as'],'attributes':_0x32fb09[_0xb599('0x1d')],'include':_0x32fb09[_0xb599('0x1a')]?_[_0xb599('0x1b')](_0x32fb09['include'],function(_0x3360be){return{'model':db[_0x3360be[_0xb599('0x1c')]],'as':_0x3360be['as'],'attributes':_0x3360be[_0xb599('0x1d')],'include':_0x3360be[_0xb599('0x1a')]?_[_0xb599('0x1b')](_0x3360be[_0xb599('0x1a')],function(_0x105ef3){return{'model':db[_0x105ef3[_0xb599('0x1c')]],'as':_0x105ef3['as'],'attributes':_0x105ef3[_0xb599('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb599('0x1e')](function(_0x934d9c){logger[_0xb599('0xb')](_0xb599('0x14'),_0x33cc95);logger[_0xb599('0x1f')]('GetVoiceCallReport',_0x33cc95,JSON['stringify'](_0x934d9c));_0x586db4(_0x934d9c);})[_0xb599('0x13')](function(_0x48e7e8){logger['error'](_0xb599('0x14'),_0x48e7e8[_0xb599('0x11')],_0x33cc95);_0x36d9fc(_0x4b5b94[_0xb599('0xf')](0x1f4,_0x48e7e8[_0xb599('0x11')]));});});};exports[_0xb599('0x20')]=function(_0x4bf79e){var _0x37d2dc=this;return new Promise(function(_0x48a3a0,_0x39cdd7){return db[_0xb599('0x15')][_0xb599('0x21')](_0x4bf79e[_0xb599('0x22')],{'raw':_0x4bf79e[_0xb599('0x17')]?_0x4bf79e['options'][_0xb599('0x18')]===undefined?!![]:![]:!![]})[_0xb599('0x1e')](function(_0x1dfdb2){logger[_0xb599('0xb')](_0xb599('0x20'),_0x4bf79e);logger[_0xb599('0x1f')](_0xb599('0x20'),_0x4bf79e,JSON['stringify'](_0x1dfdb2));_0x48a3a0(_0x1dfdb2);})[_0xb599('0x13')](function(_0x1a02fc){logger[_0xb599('0xf')](_0xb599('0x20'),_0x1a02fc[_0xb599('0x11')],_0x4bf79e);_0x39cdd7(_0x37d2dc[_0xb599('0xf')](0x1f4,_0x1a02fc[_0xb599('0x11')]));});});};exports[_0xb599('0x23')]=function(_0xd8637a){var _0x25141f=this;return new Promise(function(_0x532146,_0x27b804){return db[_0xb599('0x15')]['update'](_0xd8637a[_0xb599('0x22')],{'raw':_0xd8637a[_0xb599('0x17')]?_0xd8637a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd8637a[_0xb599('0x17')]?_0xd8637a[_0xb599('0x17')][_0xb599('0x24')]||null:null,'attributes':_0xd8637a[_0xb599('0x17')]?_0xd8637a[_0xb599('0x17')][_0xb599('0x1d')]||null:null,'limit':_0xd8637a[_0xb599('0x17')]?_0xd8637a[_0xb599('0x17')]['limit']||null:null})[_0xb599('0x1e')](function(_0x171bfa){logger[_0xb599('0xb')](_0xb599('0x23'),_0xd8637a);logger['debug'](_0xb599('0x23'),_0xd8637a,JSON[_0xb599('0xe')](_0x171bfa));_0x532146(_0x171bfa);})[_0xb599('0x13')](function(_0x170cb5){logger[_0xb599('0xf')]('UpdateVoiceCallReport',_0x170cb5[_0xb599('0x11')],_0xd8637a);_0x27b804(_0x25141f[_0xb599('0xf')](0x1f4,_0x170cb5['message']));});});};