Built motion from commit (unavailable).|2.4.13
[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 _0x63ff=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateVoiceCallReport','UpdateVoiceCallReport','lodash','moment'];(function(_0x529059,_0x294a33){var _0x156bc2=function(_0x9bc770){while(--_0x9bc770){_0x529059['push'](_0x529059['shift']());}};_0x156bc2(++_0x294a33);}(_0x63ff,0x195));var _0xf63f=function(_0xc92087,_0x5dc511){_0xc92087=_0xc92087-0x0;var _0x431aba=_0x63ff[_0xc92087];return _0x431aba;};'use strict';var _=require(_0xf63f('0x0'));var util=require('util');var moment=require(_0xf63f('0x1'));var BPromise=require(_0xf63f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf63f('0x3'));var db=require(_0xf63f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf63f('0x5'))(_0xf63f('0x6'));var config=require(_0xf63f('0x7'));var jayson=require(_0xf63f('0x8'));var client=jayson[_0xf63f('0x9')][_0xf63f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44b492,_0x5df292,_0x12d51a){return new BPromise(function(_0x439563,_0x52a76e){return client[_0xf63f('0xb')](_0x44b492,_0x12d51a)[_0xf63f('0xc')](function(_0x404677){logger[_0xf63f('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x5df292,_0xf63f('0xe'));logger[_0xf63f('0xf')](_0xf63f('0x10'),_0x5df292,_0xf63f('0xe'),JSON[_0xf63f('0x11')](_0x404677));if(_0x404677[_0xf63f('0x12')]){if(_0x404677[_0xf63f('0x12')][_0xf63f('0x13')]===0x1f4){logger[_0xf63f('0x12')](_0xf63f('0x14'),_0x5df292,_0x404677[_0xf63f('0x12')][_0xf63f('0x15')]);return _0x52a76e(_0x404677[_0xf63f('0x12')][_0xf63f('0x15')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x5df292,_0x404677[_0xf63f('0x12')][_0xf63f('0x15')]);return _0x439563(_0x404677[_0xf63f('0x12')][_0xf63f('0x15')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x5df292,_0xf63f('0xe'));_0x439563(_0x404677[_0xf63f('0x16')][_0xf63f('0x15')]);}})[_0xf63f('0x17')](function(_0x3bd3c7){logger[_0xf63f('0x12')](_0xf63f('0x14'),_0x5df292,_0x3bd3c7);_0x52a76e(_0x3bd3c7);});});}exports[_0xf63f('0x18')]=function(_0x1f313e){var _0x20dbd7=this;return new Promise(function(_0x4448c3,_0x2b937e){return db[_0xf63f('0x19')][_0xf63f('0x1a')]({'raw':_0x1f313e[_0xf63f('0x1b')]?_0x1f313e[_0xf63f('0x1b')][_0xf63f('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f313e[_0xf63f('0x1b')]?_0x1f313e['options'][_0xf63f('0x1d')]||null:null,'attributes':_0x1f313e[_0xf63f('0x1b')]?_0x1f313e[_0xf63f('0x1b')][_0xf63f('0x1e')]||null:null,'limit':_0x1f313e[_0xf63f('0x1b')]?_0x1f313e[_0xf63f('0x1b')][_0xf63f('0x1f')]||null:null,'include':_0x1f313e[_0xf63f('0x1b')]?_0x1f313e[_0xf63f('0x1b')][_0xf63f('0x20')]?_['map'](_0x1f313e[_0xf63f('0x1b')]['include'],function(_0xfe19ea){return{'model':db[_0xfe19ea[_0xf63f('0x21')]],'as':_0xfe19ea['as'],'attributes':_0xfe19ea[_0xf63f('0x1e')],'include':_0xfe19ea[_0xf63f('0x20')]?_[_0xf63f('0x22')](_0xfe19ea[_0xf63f('0x20')],function(_0x3c4041){return{'model':db[_0x3c4041[_0xf63f('0x21')]],'as':_0x3c4041['as'],'attributes':_0x3c4041[_0xf63f('0x1e')],'include':_0x3c4041[_0xf63f('0x20')]?_['map'](_0x3c4041[_0xf63f('0x20')],function(_0x148823){return{'model':db[_0x148823[_0xf63f('0x21')]],'as':_0x148823['as'],'attributes':_0x148823[_0xf63f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf63f('0xc')](function(_0x165b36){logger['info'](_0xf63f('0x18'),_0x1f313e);logger['debug'](_0xf63f('0x18'),_0x1f313e,JSON[_0xf63f('0x11')](_0x165b36));_0x4448c3(_0x165b36);})[_0xf63f('0x17')](function(_0x28d5e4){logger[_0xf63f('0x12')](_0xf63f('0x18'),_0x28d5e4[_0xf63f('0x15')],_0x1f313e);_0x2b937e(_0x20dbd7[_0xf63f('0x12')](0x1f4,_0x28d5e4[_0xf63f('0x15')]));});});};exports[_0xf63f('0x23')]=function(_0x14bbd9){var _0x124d9b=this;return new Promise(function(_0x20e0c4,_0x4e57b0){return db[_0xf63f('0x19')]['create'](_0x14bbd9['body'],{'raw':_0x14bbd9[_0xf63f('0x1b')]?_0x14bbd9[_0xf63f('0x1b')][_0xf63f('0x1c')]===undefined?!![]:![]:!![]})[_0xf63f('0xc')](function(_0x2ee054){logger[_0xf63f('0xd')](_0xf63f('0x23'),_0x14bbd9);logger[_0xf63f('0xf')](_0xf63f('0x23'),_0x14bbd9,JSON[_0xf63f('0x11')](_0x2ee054));_0x20e0c4(_0x2ee054);})[_0xf63f('0x17')](function(_0x437b5b){logger[_0xf63f('0x12')](_0xf63f('0x23'),_0x437b5b[_0xf63f('0x15')],_0x14bbd9);_0x4e57b0(_0x124d9b[_0xf63f('0x12')](0x1f4,_0x437b5b[_0xf63f('0x15')]));});});};exports[_0xf63f('0x24')]=function(_0x3df3d8){var _0x1a1445=this;return new Promise(function(_0x2fcb00,_0x2db503){return db[_0xf63f('0x19')]['update'](_0x3df3d8['body'],{'raw':_0x3df3d8[_0xf63f('0x1b')]?_0x3df3d8[_0xf63f('0x1b')][_0xf63f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3df3d8['options']?_0x3df3d8[_0xf63f('0x1b')][_0xf63f('0x1d')]||null:null,'attributes':_0x3df3d8[_0xf63f('0x1b')]?_0x3df3d8[_0xf63f('0x1b')][_0xf63f('0x1e')]||null:null,'limit':_0x3df3d8['options']?_0x3df3d8[_0xf63f('0x1b')][_0xf63f('0x1f')]||null:null})[_0xf63f('0xc')](function(_0x569156){logger[_0xf63f('0xd')](_0xf63f('0x24'),_0x3df3d8);logger[_0xf63f('0xf')](_0xf63f('0x24'),_0x3df3d8,JSON[_0xf63f('0x11')](_0x569156));_0x2fcb00(_0x569156);})[_0xf63f('0x17')](function(_0x43b6d7){logger[_0xf63f('0x12')](_0xf63f('0x24'),_0x43b6d7[_0xf63f('0x15')],_0x3df3d8);_0x2db503(_0x1a1445['error'](0x1f4,_0x43b6d7[_0xf63f('0x15')]));});});};