Built motion from commit e6806ed6.|2.6.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 _0xbd12=['GetVoiceCallReport','VoiceCallReport','options','where','attributes','limit','map','model','include','catch','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1c14e9,_0x219494){var _0x431536=function(_0x1a7c1b){while(--_0x1a7c1b){_0x1c14e9['push'](_0x1c14e9['shift']());}};_0x431536(++_0x219494);}(_0xbd12,0x196));var _0x2bd1=function(_0x273ce1,_0xbf4b88){_0x273ce1=_0x273ce1-0x0;var _0x5f2445=_0xbd12[_0x273ce1];return _0x5f2445;};'use strict';var _=require(_0x2bd1('0x0'));var util=require(_0x2bd1('0x1'));var moment=require(_0x2bd1('0x2'));var BPromise=require('bluebird');var rs=require(_0x2bd1('0x3'));var fs=require('fs');var Redis=require(_0x2bd1('0x4'));var db=require(_0x2bd1('0x5'))['db'];var utils=require(_0x2bd1('0x6'));var logger=require(_0x2bd1('0x7'))(_0x2bd1('0x8'));var config=require(_0x2bd1('0x9'));var jayson=require(_0x2bd1('0xa'));var client=jayson[_0x2bd1('0xb')][_0x2bd1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xbd896b,_0x59719f,_0x22f12d){return new BPromise(function(_0x58506e,_0x479717){return client['request'](_0xbd896b,_0x22f12d)[_0x2bd1('0xd')](function(_0x7f8d7d){logger['info'](_0x2bd1('0xe'),_0x59719f,_0x2bd1('0xf'));logger[_0x2bd1('0x10')](_0x2bd1('0x11'),_0x59719f,'request\x20sent',JSON[_0x2bd1('0x12')](_0x7f8d7d));if(_0x7f8d7d[_0x2bd1('0x13')]){if(_0x7f8d7d[_0x2bd1('0x13')][_0x2bd1('0x14')]===0x1f4){logger[_0x2bd1('0x13')](_0x2bd1('0xe'),_0x59719f,_0x7f8d7d['error'][_0x2bd1('0x15')]);return _0x479717(_0x7f8d7d[_0x2bd1('0x13')]['message']);}logger[_0x2bd1('0x13')](_0x2bd1('0xe'),_0x59719f,_0x7f8d7d[_0x2bd1('0x13')]['message']);return _0x58506e(_0x7f8d7d['error'][_0x2bd1('0x15')]);}else{logger[_0x2bd1('0x16')](_0x2bd1('0xe'),_0x59719f,_0x2bd1('0xf'));_0x58506e(_0x7f8d7d['result']['message']);}})['catch'](function(_0x23bbc0){logger[_0x2bd1('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x59719f,_0x23bbc0);_0x479717(_0x23bbc0);});});}exports[_0x2bd1('0x17')]=function(_0xab91e0){var _0x4d4a11=this;return new Promise(function(_0x3f0847,_0x296041){return db[_0x2bd1('0x18')]['findAll']({'raw':_0xab91e0[_0x2bd1('0x19')]?_0xab91e0['options']['raw']===undefined?!![]:![]:!![],'where':_0xab91e0[_0x2bd1('0x19')]?_0xab91e0[_0x2bd1('0x19')][_0x2bd1('0x1a')]||null:null,'attributes':_0xab91e0[_0x2bd1('0x19')]?_0xab91e0[_0x2bd1('0x19')][_0x2bd1('0x1b')]||null:null,'limit':_0xab91e0[_0x2bd1('0x19')]?_0xab91e0['options'][_0x2bd1('0x1c')]||null:null,'include':_0xab91e0[_0x2bd1('0x19')]?_0xab91e0[_0x2bd1('0x19')]['include']?_[_0x2bd1('0x1d')](_0xab91e0[_0x2bd1('0x19')]['include'],function(_0x548b25){return{'model':db[_0x548b25[_0x2bd1('0x1e')]],'as':_0x548b25['as'],'attributes':_0x548b25[_0x2bd1('0x1b')],'include':_0x548b25[_0x2bd1('0x1f')]?_['map'](_0x548b25[_0x2bd1('0x1f')],function(_0x292cc3){return{'model':db[_0x292cc3[_0x2bd1('0x1e')]],'as':_0x292cc3['as'],'attributes':_0x292cc3[_0x2bd1('0x1b')],'include':_0x292cc3[_0x2bd1('0x1f')]?_['map'](_0x292cc3['include'],function(_0x3116fa){return{'model':db[_0x3116fa['model']],'as':_0x3116fa['as'],'attributes':_0x3116fa[_0x2bd1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2bd1('0xd')](function(_0x54c74e){logger[_0x2bd1('0x16')](_0x2bd1('0x17'),_0xab91e0);logger[_0x2bd1('0x10')]('GetVoiceCallReport',_0xab91e0,JSON[_0x2bd1('0x12')](_0x54c74e));_0x3f0847(_0x54c74e);})[_0x2bd1('0x20')](function(_0x2a584f){logger['error'](_0x2bd1('0x17'),_0x2a584f[_0x2bd1('0x15')],_0xab91e0);_0x296041(_0x4d4a11[_0x2bd1('0x13')](0x1f4,_0x2a584f[_0x2bd1('0x15')]));});});};exports[_0x2bd1('0x21')]=function(_0x293d2e){var _0x16e610=this;return new Promise(function(_0x125697,_0x261e8a){return db[_0x2bd1('0x18')][_0x2bd1('0x22')](_0x293d2e[_0x2bd1('0x23')],{'raw':_0x293d2e[_0x2bd1('0x19')]?_0x293d2e[_0x2bd1('0x19')][_0x2bd1('0x24')]===undefined?!![]:![]:!![]})[_0x2bd1('0xd')](function(_0x18c879){logger[_0x2bd1('0x16')](_0x2bd1('0x21'),_0x293d2e);logger['debug'](_0x2bd1('0x21'),_0x293d2e,JSON[_0x2bd1('0x12')](_0x18c879));_0x125697(_0x18c879);})['catch'](function(_0x4ccd34){logger['error']('CreateVoiceCallReport',_0x4ccd34[_0x2bd1('0x15')],_0x293d2e);_0x261e8a(_0x16e610[_0x2bd1('0x13')](0x1f4,_0x4ccd34[_0x2bd1('0x15')]));});});};exports[_0x2bd1('0x25')]=function(_0x59857a){var _0x1ca3a2=this;return new Promise(function(_0x805c82,_0x59004a){return db[_0x2bd1('0x18')][_0x2bd1('0x26')](_0x59857a[_0x2bd1('0x23')],{'raw':_0x59857a[_0x2bd1('0x19')]?_0x59857a[_0x2bd1('0x19')][_0x2bd1('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59857a['options']?_0x59857a[_0x2bd1('0x19')][_0x2bd1('0x1a')]||null:null,'attributes':_0x59857a[_0x2bd1('0x19')]?_0x59857a[_0x2bd1('0x19')]['attributes']||null:null,'limit':_0x59857a[_0x2bd1('0x19')]?_0x59857a[_0x2bd1('0x19')]['limit']||null:null})[_0x2bd1('0xd')](function(_0x4191a2){logger[_0x2bd1('0x16')]('UpdateVoiceCallReport',_0x59857a);logger[_0x2bd1('0x10')](_0x2bd1('0x25'),_0x59857a,JSON[_0x2bd1('0x12')](_0x4191a2));_0x805c82(_0x4191a2);})[_0x2bd1('0x20')](function(_0x2dfc00){logger['error'](_0x2bd1('0x25'),_0x2dfc00[_0x2bd1('0x15')],_0x59857a);_0x59004a(_0x1ca3a2['error'](0x1f4,_0x2dfc00['message']));});});};