Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / api / analyticTreeReport / analyticTreeReport.controller.js
index 8d0160e..4ec5fef 100644 (file)
@@ -1 +1 @@
-const a31_0x28ca=['options','destroy','AnalyticTreeReport','pick','includeAll','include','then','../../components/parsers/qs','params','rawAttributes','merge','stack','sequelize','map','query','intersection','../../mysqldb','filters','key','json','fieldName','findOne','model','filter','limit','create','update','where','attributes','name','fields','offset','keys','send','order','rows','type','count','../../config/logger','status','lodash','findAll','like','body','error','length','undefined','show','Content-Range','catch','set','VIRTUAL'];(function(_0x4e8cfb,_0xbca1d8){const _0x28cad5=function(_0x27f6cb){while(--_0x27f6cb){_0x4e8cfb['push'](_0x4e8cfb['shift']());}};_0x28cad5(++_0xbca1d8);}(a31_0x28ca,0x8a));const a31_0x27f6=function(_0x4e8cfb,_0xbca1d8){_0x4e8cfb=_0x4e8cfb-0x181;let _0x28cad5=a31_0x28ca[_0x4e8cfb];return _0x28cad5;};const a31_0x307ea5=a31_0x27f6;'use strict';const _=require(a31_0x307ea5(0x187)),qs=require(a31_0x307ea5(0x19a)),logger=require(a31_0x307ea5(0x185))('api'),{db}=require(a31_0x307ea5(0x1a3)),{Op}=require(a31_0x307ea5(0x19f));function respondWithResult(_0x8dd56d,_0x10dc44){return _0x10dc44=_0x10dc44||0xc8,function(_0x26178c){const _0x1b0054=a31_0x27f6;if(_0x26178c)return _0x8dd56d['status'](_0x10dc44)[_0x1b0054(0x1a6)](_0x26178c);};}function respondWithFilteredResult(_0xeb8f90,_0x2bd5d6){return function(_0x45b900){const _0x169851=a31_0x27f6;if(_0x45b900){const _0x376c7a=_0x45b900[_0x169851(0x184)],_0x3c5b99=_0x2bd5d6['offset'];let _0x1c831c=_0x2bd5d6[_0x169851(0x1b2)]+_0x2bd5d6[_0x169851(0x1ab)],_0x19284e;return _0x1c831c>=_0x376c7a?(_0x1c831c=_0x376c7a,_0x19284e=0xc8):_0x19284e=0xce,_0xeb8f90[_0x169851(0x186)](_0x19284e),_0xeb8f90[_0x169851(0x191)](_0x169851(0x18f),_0x3c5b99+'-'+_0x1c831c+'/'+_0x376c7a)[_0x169851(0x1a6)](_0x45b900);}return null;};}function saveUpdates(_0xf77bf2){return function(_0x21ea0){const _0x5794e3=a31_0x27f6;if(_0x21ea0)return _0x21ea0[_0x5794e3(0x1ad)](_0xf77bf2)[_0x5794e3(0x199)](function(_0x4223c8){return _0x4223c8;});return null;};}function removeEntity(_0x4df5c9){return function(_0x191eb8){const _0x4c7921=a31_0x27f6;if(_0x191eb8)return _0x191eb8[_0x4c7921(0x194)]()[_0x4c7921(0x199)](function(){const _0x2e4048=_0x4c7921;_0x4df5c9[_0x2e4048(0x186)](0xcc)['end']();});};}function handleEntityNotFound(_0xaf515){return function(_0x5b50f3){return!_0x5b50f3&&_0xaf515['sendStatus'](0x194),_0x5b50f3;};}function handleError(_0x445892,_0x11f887){return _0x11f887=_0x11f887||0x1f4,function(_0x4a9b93){const _0x235432=a31_0x27f6;logger[_0x235432(0x18b)](_0x4a9b93[_0x235432(0x19e)]),_0x4a9b93[_0x235432(0x1b0)]&&delete _0x4a9b93[_0x235432(0x1b0)],_0x445892['status'](_0x11f887)[_0x235432(0x1b4)](_0x4a9b93);};}exports['index']=function(_0x3b5502,_0x68fad0){const _0x502352=a31_0x307ea5;let _0x229aa5={};const _0x29a8e0={},_0x4dd27d={'count':0x0,'rows':[]},_0x6a5d93=_[_0x502352(0x1a0)](db[_0x502352(0x195)][_0x502352(0x19c)],function(_0x429a92){const _0xe10e0=_0x502352;return{'name':_0x429a92[_0xe10e0(0x1a7)],'type':_0x429a92[_0xe10e0(0x183)][_0xe10e0(0x1a5)]};});_0x29a8e0['model']=_[_0x502352(0x1a0)](_0x6a5d93,_0x502352(0x1b0)),_0x29a8e0[_0x502352(0x1a1)]=_['keys'](_0x3b5502[_0x502352(0x1a1)]),_0x29a8e0[_0x502352(0x1a4)]=_[_0x502352(0x1a2)](_0x29a8e0[_0x502352(0x1a9)],_0x29a8e0[_0x502352(0x1a1)]),_0x229aa5[_0x502352(0x1af)]=_[_0x502352(0x1a2)](_0x29a8e0[_0x502352(0x1a9)],qs['fields'](_0x3b5502['query'][_0x502352(0x1b1)])),_0x229aa5[_0x502352(0x1af)]=_0x229aa5[_0x502352(0x1af)][_0x502352(0x18c)]?_0x229aa5[_0x502352(0x1af)]:_0x29a8e0['model'];typeof _0x3b5502[_0x502352(0x1a1)]['nolimit']===_0x502352(0x18d)&&(_0x229aa5[_0x502352(0x1ab)]=qs[_0x502352(0x1ab)](_0x3b5502[_0x502352(0x1a1)][_0x502352(0x1ab)]),_0x229aa5[_0x502352(0x1b2)]=qs[_0x502352(0x1b2)](_0x3b5502[_0x502352(0x1a1)][_0x502352(0x1b2)]));_0x229aa5[_0x502352(0x181)]=qs['sort'](_0x3b5502[_0x502352(0x1a1)]['sort']),_0x229aa5[_0x502352(0x1ae)]=qs['filters'](_[_0x502352(0x196)](_0x3b5502[_0x502352(0x1a1)],_0x29a8e0['filters']),_0x6a5d93);_0x3b5502[_0x502352(0x1a1)][_0x502352(0x1aa)]&&(_0x229aa5[_0x502352(0x1ae)]=_[_0x502352(0x19d)](_0x229aa5[_0x502352(0x1ae)],{[Op['or']]:_[_0x502352(0x1a0)](_0x6a5d93,function(_0x266069){const _0x149156=_0x502352;if(_0x266069[_0x149156(0x183)]!==_0x149156(0x192)){const _0x1a0555={};return _0x1a0555[_0x266069[_0x149156(0x1b0)]]={[Op[_0x149156(0x189)]]:'%'+_0x3b5502[_0x149156(0x1a1)]['filter']+'%'},_0x1a0555;}})}));_0x229aa5=_[_0x502352(0x19d)]({},_0x229aa5,_0x3b5502[_0x502352(0x193)]);const _0x76ca69={'where':_0x229aa5[_0x502352(0x1ae)]};return db[_0x502352(0x195)][_0x502352(0x184)](_0x76ca69)[_0x502352(0x199)](function(_0x2cb232){const _0x29a0cc=_0x502352;return _0x4dd27d[_0x29a0cc(0x184)]=_0x2cb232,_0x3b5502['query'][_0x29a0cc(0x197)]&&(_0x229aa5['include']=[{'all':!![]}]),db['AnalyticTreeReport'][_0x29a0cc(0x188)](_0x229aa5);})[_0x502352(0x199)](function(_0x233c30){const _0x10f376=_0x502352;return _0x4dd27d[_0x10f376(0x182)]=_0x233c30,_0x4dd27d;})[_0x502352(0x199)](respondWithFilteredResult(_0x68fad0,_0x229aa5))['catch'](handleError(_0x68fad0,null));},exports[a31_0x307ea5(0x18e)]=function(_0x536d99,_0x4768b7){const _0xc8c9eb=a31_0x307ea5;let _0x19ebf2={'raw':!![],'where':{'id':_0x536d99[_0xc8c9eb(0x19b)]['id']}};const _0x55b714={};return _0x55b714[_0xc8c9eb(0x1a9)]=_[_0xc8c9eb(0x1b3)](db[_0xc8c9eb(0x195)]['rawAttributes']),_0x55b714[_0xc8c9eb(0x1a1)]=_[_0xc8c9eb(0x1b3)](_0x536d99[_0xc8c9eb(0x1a1)]),_0x55b714[_0xc8c9eb(0x1a4)]=_[_0xc8c9eb(0x1a2)](_0x55b714[_0xc8c9eb(0x1a9)],_0x55b714[_0xc8c9eb(0x1a1)]),_0x19ebf2[_0xc8c9eb(0x1af)]=_[_0xc8c9eb(0x1a2)](_0x55b714[_0xc8c9eb(0x1a9)],qs['fields'](_0x536d99[_0xc8c9eb(0x1a1)][_0xc8c9eb(0x1b1)])),_0x19ebf2[_0xc8c9eb(0x1af)]=_0x19ebf2[_0xc8c9eb(0x1af)][_0xc8c9eb(0x18c)]?_0x19ebf2[_0xc8c9eb(0x1af)]:_0x55b714[_0xc8c9eb(0x1a9)],_0x536d99['query'][_0xc8c9eb(0x197)]&&(_0x19ebf2[_0xc8c9eb(0x198)]=[{'all':!![]}]),_0x19ebf2=_[_0xc8c9eb(0x19d)]({},_0x19ebf2,_0x536d99[_0xc8c9eb(0x193)]),db['AnalyticTreeReport']['findOne'](_0x19ebf2)[_0xc8c9eb(0x199)](handleEntityNotFound(_0x4768b7,null))[_0xc8c9eb(0x199)](respondWithResult(_0x4768b7,null))[_0xc8c9eb(0x190)](handleError(_0x4768b7,null));},exports[a31_0x307ea5(0x1ac)]=function(_0xa5af79,_0x3db305){const _0x1f8318=a31_0x307ea5;return db[_0x1f8318(0x195)][_0x1f8318(0x1ac)](_0xa5af79[_0x1f8318(0x18a)],{})[_0x1f8318(0x199)](respondWithResult(_0x3db305,0xc9))[_0x1f8318(0x190)](handleError(_0x3db305,null));},exports[a31_0x307ea5(0x1ad)]=function(_0x982e11,_0x3c9e65){const _0x1603ae=a31_0x307ea5;return _0x982e11[_0x1603ae(0x18a)]['id']&&delete _0x982e11[_0x1603ae(0x18a)]['id'],db[_0x1603ae(0x195)][_0x1603ae(0x1a8)]({'where':{'id':_0x982e11[_0x1603ae(0x19b)]['id']}})[_0x1603ae(0x199)](handleEntityNotFound(_0x3c9e65,null))[_0x1603ae(0x199)](saveUpdates(_0x982e11['body'],null))[_0x1603ae(0x199)](respondWithResult(_0x3c9e65,null))['catch'](handleError(_0x3c9e65,null));},exports[a31_0x307ea5(0x194)]=function(_0x2c2dc0,_0x17f77b){const _0xf2d5c7=a31_0x307ea5;return db[_0xf2d5c7(0x195)][_0xf2d5c7(0x1a8)]({'where':{'id':_0x2c2dc0[_0xf2d5c7(0x19b)]['id']}})[_0xf2d5c7(0x199)](handleEntityNotFound(_0x17f77b,null))[_0xf2d5c7(0x199)](removeEntity(_0x17f77b,null))[_0xf2d5c7(0x190)](handleError(_0x17f77b,null));};
\ No newline at end of file
+const a31_0x1804=['length','fields','rows','show','map','send','filters','includeAll','nolimit','update','VIRTUAL','limit','include','catch','AnalyticTreeReport','Content-Range','findAll','sort','filter','intersection','model','where','undefined','status','rawAttributes','create','lodash','fieldName','sequelize','json','params','offset','merge','sendStatus','error','name','then','attributes','index','body','type','query','options','count','keys','findOne','../../config/logger','destroy'];(function(_0xe0a17,_0x5a2c58){const _0x180414=function(_0xfac8a6){while(--_0xfac8a6){_0xe0a17['push'](_0xe0a17['shift']());}};_0x180414(++_0x5a2c58);}(a31_0x1804,0x13d));const a31_0xfac8=function(_0xe0a17,_0x5a2c58){_0xe0a17=_0xe0a17-0x123;let _0x180414=a31_0x1804[_0xe0a17];return _0x180414;};const a31_0x2608a8=a31_0xfac8;'use strict';const _=require(a31_0x2608a8(0x150)),qs=require('../../components/parsers/qs'),logger=require(a31_0x2608a8(0x134))('api'),{db}=require('../../mysqldb'),{Op}=require(a31_0x2608a8(0x152));function respondWithResult(_0x3dcf98,_0x165c7b){return _0x165c7b=_0x165c7b||0xc8,function(_0xd6efe){const _0x2f497f=a31_0xfac8;if(_0xd6efe)return _0x3dcf98[_0x2f497f(0x14d)](_0x165c7b)['json'](_0xd6efe);};}function respondWithFilteredResult(_0x37042e,_0x22c13a){return function(_0x323d80){const _0xba2644=a31_0xfac8;if(_0x323d80){const _0x11209d=_0x323d80[_0xba2644(0x131)],_0x277187=_0x22c13a[_0xba2644(0x125)];let _0x5e2a08=_0x22c13a['offset']+_0x22c13a['limit'],_0x1353ba;return _0x5e2a08>=_0x11209d?(_0x5e2a08=_0x11209d,_0x1353ba=0xc8):_0x1353ba=0xce,_0x37042e[_0xba2644(0x14d)](_0x1353ba),_0x37042e['set'](_0xba2644(0x145),_0x277187+'-'+_0x5e2a08+'/'+_0x11209d)[_0xba2644(0x123)](_0x323d80);}return null;};}function saveUpdates(_0x5b55aa){return function(_0x2a41ac){const _0xf9060c=a31_0xfac8;if(_0x2a41ac)return _0x2a41ac[_0xf9060c(0x13f)](_0x5b55aa)[_0xf9060c(0x12a)](function(_0x4f90b9){return _0x4f90b9;});return null;};}function removeEntity(_0x19ac0d){return function(_0x144962){const _0x1ebcb0=a31_0xfac8;if(_0x144962)return _0x144962['destroy']()[_0x1ebcb0(0x12a)](function(){const _0x305005=_0x1ebcb0;_0x19ac0d[_0x305005(0x14d)](0xcc)['end']();});};}function handleEntityNotFound(_0x47debc){return function(_0x580c77){const _0x110d17=a31_0xfac8;return!_0x580c77&&_0x47debc[_0x110d17(0x127)](0x194),_0x580c77;};}function handleError(_0x309135,_0x4b4ead){return _0x4b4ead=_0x4b4ead||0x1f4,function(_0x37d458){const _0x24d8ca=a31_0xfac8;logger[_0x24d8ca(0x128)](_0x37d458['stack']),_0x37d458[_0x24d8ca(0x129)]&&delete _0x37d458[_0x24d8ca(0x129)],_0x309135[_0x24d8ca(0x14d)](_0x4b4ead)[_0x24d8ca(0x13b)](_0x37d458);};}exports[a31_0x2608a8(0x12c)]=function(_0x3780dc,_0x32cc18){const _0x4aa2d4=a31_0x2608a8;let _0x2cc481={};const _0x3fe47b={},_0x5ab556={'count':0x0,'rows':[]},_0x487a3f=_['map'](db['AnalyticTreeReport'][_0x4aa2d4(0x14e)],function(_0x27761d){const _0x5e022a=_0x4aa2d4;return{'name':_0x27761d[_0x5e022a(0x151)],'type':_0x27761d[_0x5e022a(0x12e)]['key']};});_0x3fe47b['model']=_[_0x4aa2d4(0x13a)](_0x487a3f,_0x4aa2d4(0x129)),_0x3fe47b[_0x4aa2d4(0x12f)]=_[_0x4aa2d4(0x132)](_0x3780dc[_0x4aa2d4(0x12f)]),_0x3fe47b[_0x4aa2d4(0x13c)]=_[_0x4aa2d4(0x149)](_0x3fe47b[_0x4aa2d4(0x14a)],_0x3fe47b[_0x4aa2d4(0x12f)]),_0x2cc481[_0x4aa2d4(0x12b)]=_[_0x4aa2d4(0x149)](_0x3fe47b[_0x4aa2d4(0x14a)],qs[_0x4aa2d4(0x137)](_0x3780dc[_0x4aa2d4(0x12f)]['fields'])),_0x2cc481[_0x4aa2d4(0x12b)]=_0x2cc481[_0x4aa2d4(0x12b)][_0x4aa2d4(0x136)]?_0x2cc481[_0x4aa2d4(0x12b)]:_0x3fe47b[_0x4aa2d4(0x14a)];typeof _0x3780dc[_0x4aa2d4(0x12f)][_0x4aa2d4(0x13e)]===_0x4aa2d4(0x14c)&&(_0x2cc481['limit']=qs['limit'](_0x3780dc[_0x4aa2d4(0x12f)][_0x4aa2d4(0x141)]),_0x2cc481[_0x4aa2d4(0x125)]=qs[_0x4aa2d4(0x125)](_0x3780dc[_0x4aa2d4(0x12f)][_0x4aa2d4(0x125)]));_0x2cc481['order']=qs[_0x4aa2d4(0x147)](_0x3780dc['query'][_0x4aa2d4(0x147)]),_0x2cc481[_0x4aa2d4(0x14b)]=qs[_0x4aa2d4(0x13c)](_['pick'](_0x3780dc[_0x4aa2d4(0x12f)],_0x3fe47b[_0x4aa2d4(0x13c)]),_0x487a3f);_0x3780dc[_0x4aa2d4(0x12f)][_0x4aa2d4(0x148)]&&(_0x2cc481[_0x4aa2d4(0x14b)]=_[_0x4aa2d4(0x126)](_0x2cc481[_0x4aa2d4(0x14b)],{[Op['or']]:_[_0x4aa2d4(0x13a)](_0x487a3f,function(_0x14718f){const _0x528858=_0x4aa2d4;if(_0x14718f['type']!==_0x528858(0x140)){const _0xcd93c6={};return _0xcd93c6[_0x14718f[_0x528858(0x129)]]={[Op['like']]:'%'+_0x3780dc[_0x528858(0x12f)][_0x528858(0x148)]+'%'},_0xcd93c6;}})}));_0x2cc481=_[_0x4aa2d4(0x126)]({},_0x2cc481,_0x3780dc[_0x4aa2d4(0x130)]);const _0x3ee814={'where':_0x2cc481[_0x4aa2d4(0x14b)]};return db['AnalyticTreeReport']['count'](_0x3ee814)['then'](function(_0x97fd1a){const _0xd6ee8=_0x4aa2d4;return _0x5ab556['count']=_0x97fd1a,_0x3780dc[_0xd6ee8(0x12f)][_0xd6ee8(0x13d)]&&(_0x2cc481[_0xd6ee8(0x142)]=[{'all':!![]}]),db[_0xd6ee8(0x144)][_0xd6ee8(0x146)](_0x2cc481);})['then'](function(_0x2ef162){const _0x2ab590=_0x4aa2d4;return _0x5ab556[_0x2ab590(0x138)]=_0x2ef162,_0x5ab556;})['then'](respondWithFilteredResult(_0x32cc18,_0x2cc481))[_0x4aa2d4(0x143)](handleError(_0x32cc18,null));},exports[a31_0x2608a8(0x139)]=function(_0x4b6f75,_0x18d6dd){const _0x4bbe76=a31_0x2608a8;let _0x1750d5={'raw':!![],'where':{'id':_0x4b6f75[_0x4bbe76(0x124)]['id']}};const _0x5a52f4={};return _0x5a52f4[_0x4bbe76(0x14a)]=_[_0x4bbe76(0x132)](db[_0x4bbe76(0x144)][_0x4bbe76(0x14e)]),_0x5a52f4['query']=_[_0x4bbe76(0x132)](_0x4b6f75[_0x4bbe76(0x12f)]),_0x5a52f4[_0x4bbe76(0x13c)]=_[_0x4bbe76(0x149)](_0x5a52f4[_0x4bbe76(0x14a)],_0x5a52f4['query']),_0x1750d5[_0x4bbe76(0x12b)]=_['intersection'](_0x5a52f4[_0x4bbe76(0x14a)],qs[_0x4bbe76(0x137)](_0x4b6f75[_0x4bbe76(0x12f)][_0x4bbe76(0x137)])),_0x1750d5['attributes']=_0x1750d5[_0x4bbe76(0x12b)][_0x4bbe76(0x136)]?_0x1750d5[_0x4bbe76(0x12b)]:_0x5a52f4['model'],_0x4b6f75[_0x4bbe76(0x12f)][_0x4bbe76(0x13d)]&&(_0x1750d5[_0x4bbe76(0x142)]=[{'all':!![]}]),_0x1750d5=_[_0x4bbe76(0x126)]({},_0x1750d5,_0x4b6f75[_0x4bbe76(0x130)]),db['AnalyticTreeReport']['findOne'](_0x1750d5)[_0x4bbe76(0x12a)](handleEntityNotFound(_0x18d6dd,null))[_0x4bbe76(0x12a)](respondWithResult(_0x18d6dd,null))[_0x4bbe76(0x143)](handleError(_0x18d6dd,null));},exports[a31_0x2608a8(0x14f)]=function(_0x5a9ca4,_0xd0667e){const _0xeaaae6=a31_0x2608a8;return db['AnalyticTreeReport'][_0xeaaae6(0x14f)](_0x5a9ca4[_0xeaaae6(0x12d)],{})[_0xeaaae6(0x12a)](respondWithResult(_0xd0667e,0xc9))[_0xeaaae6(0x143)](handleError(_0xd0667e,null));},exports['update']=function(_0x5cd424,_0x394df1){const _0xd5c5d4=a31_0x2608a8;return _0x5cd424['body']['id']&&delete _0x5cd424[_0xd5c5d4(0x12d)]['id'],db[_0xd5c5d4(0x144)][_0xd5c5d4(0x133)]({'where':{'id':_0x5cd424[_0xd5c5d4(0x124)]['id']}})[_0xd5c5d4(0x12a)](handleEntityNotFound(_0x394df1,null))['then'](saveUpdates(_0x5cd424['body'],null))['then'](respondWithResult(_0x394df1,null))[_0xd5c5d4(0x143)](handleError(_0x394df1,null));},exports[a31_0x2608a8(0x135)]=function(_0x2f1321,_0x3ebacb){const _0x1530b8=a31_0x2608a8;return db[_0x1530b8(0x144)][_0x1530b8(0x133)]({'where':{'id':_0x2f1321[_0x1530b8(0x124)]['id']}})[_0x1530b8(0x12a)](handleEntityNotFound(_0x3ebacb,null))['then'](removeEntity(_0x3ebacb,null))['catch'](handleError(_0x3ebacb,null));};
\ No newline at end of file