Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / jscriptyAnswerReport / jscriptyAnswerReport.controller.js
1 const a374_0x1a63=['update','options','key','show','findOne','keys','filters','count','length','VIRTUAL','offset','map','includeAll','describe','query','intersection','catch','end','error','nolimit','sort','name','lodash','json','../../mysqldb','stack','fields','sequelize','rawAttributes','merge','../../config/logger','create','status','params','include','JscriptyAnswerReport','attributes','send','body','like','findAll','Content-Range','filter','where','destroy','model','type','rows','limit','then','api'];(function(_0x3c741f,_0x1a6342){const _0x28ad23=function(_0x1288e0){while(--_0x1288e0){_0x3c741f['push'](_0x3c741f['shift']());}};_0x28ad23(++_0x1a6342);}(a374_0x1a63,0x125));const a374_0x28ad=function(_0x3c741f,_0x1a6342){_0x3c741f=_0x3c741f-0x0;let _0x28ad23=a374_0x1a63[_0x3c741f];return _0x28ad23;};const _0x32dc91=a374_0x28ad;'use strict';const _=require(_0x32dc91('0x23')),qs=require('../../components/parsers/qs'),logger=require(_0x32dc91('0x2b'))(_0x32dc91('0xc')),db=require(_0x32dc91('0x25'))['db'],{Op}=require(_0x32dc91('0x28'));function respondWithResult(_0x1288e0,_0x53071c){return _0x53071c=_0x53071c||0xc8,function(_0x560956){const _0x50dbc3=a374_0x28ad;if(_0x560956)return _0x1288e0[_0x50dbc3('0x2d')](_0x53071c)[_0x50dbc3('0x24')](_0x560956);};}function respondWithFilteredResult(_0x4d4fcc,_0x4e8796){return function(_0x4ff298){const _0x382aa0=a374_0x28ad;if(_0x4ff298){const _0x49435d=_0x4ff298[_0x382aa0('0x14')],_0x2e06d3=_0x4e8796['offset'];let _0x1b2576=_0x4e8796[_0x382aa0('0x17')]+_0x4e8796['limit'],_0x543ba7;return _0x1b2576>=_0x49435d?(_0x1b2576=_0x49435d,_0x543ba7=0xc8):_0x543ba7=0xce,_0x4d4fcc[_0x382aa0('0x2d')](_0x543ba7),_0x4d4fcc['set'](_0x382aa0('0x3'),_0x2e06d3+'-'+_0x1b2576+'/'+_0x49435d)[_0x382aa0('0x24')](_0x4ff298);}return null;};}function saveUpdates(_0x313b23){return function(_0x485400){const _0x302d84=a374_0x28ad;if(_0x485400)return _0x485400[_0x302d84('0xd')](_0x313b23)[_0x302d84('0xb')](function(_0x102548){return _0x102548;});return null;};}function removeEntity(_0xc690de){return function(_0x187968){const _0x4ef911=a374_0x28ad;if(_0x187968)return _0x187968[_0x4ef911('0x6')]()[_0x4ef911('0xb')](function(){const _0x2194cf=_0x4ef911;_0xc690de[_0x2194cf('0x2d')](0xcc)[_0x2194cf('0x1e')]();});};}function handleEntityNotFound(_0x4dc5bd){return function(_0x38e1a9){return!_0x38e1a9&&_0x4dc5bd['sendStatus'](0x194),_0x38e1a9;};}function handleError(_0x27fa28,_0x9cf700){return _0x9cf700=_0x9cf700||0x1f4,function(_0x1b1bfc){const _0x19de76=a374_0x28ad;logger[_0x19de76('0x1f')](_0x1b1bfc[_0x19de76('0x26')]),_0x1b1bfc[_0x19de76('0x22')]&&delete _0x1b1bfc[_0x19de76('0x22')],_0x27fa28[_0x19de76('0x2d')](_0x9cf700)[_0x19de76('0x32')](_0x1b1bfc);};}exports['index']=function(_0x2d0546,_0x5096d4){const _0x34b8a5=_0x32dc91;let _0x537489={};const _0xb9c074={},_0x44feae={'count':0x0,'rows':[]},_0x54b35b=_['map'](db['JscriptyAnswerReport']['rawAttributes'],function(_0x3ddbcc){const _0x1f2d10=a374_0x28ad;return{'name':_0x3ddbcc['fieldName'],'type':_0x3ddbcc['type'][_0x1f2d10('0xf')]};});_0xb9c074['model']=_[_0x34b8a5('0x18')](_0x54b35b,_0x34b8a5('0x22')),_0xb9c074[_0x34b8a5('0x1b')]=_[_0x34b8a5('0x12')](_0x2d0546['query']),_0xb9c074[_0x34b8a5('0x13')]=_[_0x34b8a5('0x1c')](_0xb9c074[_0x34b8a5('0x7')],_0xb9c074[_0x34b8a5('0x1b')]),_0x537489[_0x34b8a5('0x31')]=_[_0x34b8a5('0x1c')](_0xb9c074[_0x34b8a5('0x7')],qs[_0x34b8a5('0x27')](_0x2d0546[_0x34b8a5('0x1b')]['fields'])),_0x537489['attributes']=_0x537489[_0x34b8a5('0x31')][_0x34b8a5('0x15')]?_0x537489[_0x34b8a5('0x31')]:_0xb9c074[_0x34b8a5('0x7')];typeof _0x2d0546['query'][_0x34b8a5('0x20')]==='undefined'&&(_0x537489['limit']=qs[_0x34b8a5('0xa')](_0x2d0546['query'][_0x34b8a5('0xa')]),_0x537489[_0x34b8a5('0x17')]=qs[_0x34b8a5('0x17')](_0x2d0546['query'][_0x34b8a5('0x17')]));_0x537489['order']=qs['sort'](_0x2d0546['query'][_0x34b8a5('0x21')]),_0x537489[_0x34b8a5('0x5')]=qs[_0x34b8a5('0x13')](_['pick'](_0x2d0546['query'],_0xb9c074[_0x34b8a5('0x13')]),_0x54b35b);_0x2d0546[_0x34b8a5('0x1b')]['filter']&&(_0x537489['where']=_[_0x34b8a5('0x2a')](_0x537489[_0x34b8a5('0x5')],{[Op['or']]:_[_0x34b8a5('0x18')](_0x54b35b,function(_0xc93007){const _0x277807=_0x34b8a5;if(_0xc93007[_0x277807('0x8')]!==_0x277807('0x16')){const _0x1ded99={};return _0x1ded99[_0xc93007[_0x277807('0x22')]]={[Op[_0x277807('0x1')]]:'%'+_0x2d0546['query'][_0x277807('0x4')]+'%'},_0x1ded99;}})}));_0x537489=_[_0x34b8a5('0x2a')]({},_0x537489,_0x2d0546[_0x34b8a5('0xe')]);const _0x36e93a={'where':_0x537489[_0x34b8a5('0x5')]};return db['JscriptyAnswerReport']['count'](_0x36e93a)[_0x34b8a5('0xb')](function(_0x36d3bc){const _0x1c8553=_0x34b8a5;return _0x44feae[_0x1c8553('0x14')]=_0x36d3bc,_0x2d0546[_0x1c8553('0x1b')]['includeAll']&&(_0x537489[_0x1c8553('0x2f')]=[{'all':!![]}]),db['JscriptyAnswerReport'][_0x1c8553('0x2')](_0x537489);})[_0x34b8a5('0xb')](function(_0x13009a){const _0x3fb24d=_0x34b8a5;return _0x44feae[_0x3fb24d('0x9')]=_0x13009a,_0x44feae;})['then'](respondWithFilteredResult(_0x5096d4,_0x537489))[_0x34b8a5('0x1d')](handleError(_0x5096d4,null));},exports[_0x32dc91('0x10')]=function(_0x5e1399,_0x4cda47){const _0x2ca800=_0x32dc91;let _0x47b651={'raw':!![],'where':{'id':_0x5e1399[_0x2ca800('0x2e')]['id']}};const _0x359ec7={};return _0x359ec7['model']=_[_0x2ca800('0x12')](db[_0x2ca800('0x30')][_0x2ca800('0x29')]),_0x359ec7[_0x2ca800('0x1b')]=_[_0x2ca800('0x12')](_0x5e1399[_0x2ca800('0x1b')]),_0x359ec7[_0x2ca800('0x13')]=_[_0x2ca800('0x1c')](_0x359ec7[_0x2ca800('0x7')],_0x359ec7[_0x2ca800('0x1b')]),_0x47b651[_0x2ca800('0x31')]=_[_0x2ca800('0x1c')](_0x359ec7['model'],qs[_0x2ca800('0x27')](_0x5e1399[_0x2ca800('0x1b')][_0x2ca800('0x27')])),_0x47b651[_0x2ca800('0x31')]=_0x47b651['attributes'][_0x2ca800('0x15')]?_0x47b651[_0x2ca800('0x31')]:_0x359ec7['model'],_0x5e1399[_0x2ca800('0x1b')][_0x2ca800('0x19')]&&(_0x47b651[_0x2ca800('0x2f')]=[{'all':!![]}]),_0x47b651=_[_0x2ca800('0x2a')]({},_0x47b651,_0x5e1399[_0x2ca800('0xe')]),db[_0x2ca800('0x30')]['findOne'](_0x47b651)[_0x2ca800('0xb')](handleEntityNotFound(_0x4cda47,null))[_0x2ca800('0xb')](respondWithResult(_0x4cda47,null))[_0x2ca800('0x1d')](handleError(_0x4cda47,null));},exports[_0x32dc91('0x2c')]=function(_0x5b6844,_0x500062){const _0x23cc0c=_0x32dc91;return db[_0x23cc0c('0x30')][_0x23cc0c('0x2c')](_0x5b6844[_0x23cc0c('0x0')],{})[_0x23cc0c('0xb')](respondWithResult(_0x500062,0xc9))[_0x23cc0c('0x1d')](handleError(_0x500062,null));},exports['update']=function(_0x11bf6f,_0x58c68a){const _0x385218=_0x32dc91;return _0x11bf6f['body']['id']&&delete _0x11bf6f[_0x385218('0x0')]['id'],db['JscriptyAnswerReport']['findOne']({'where':{'id':_0x11bf6f['params']['id']}})[_0x385218('0xb')](handleEntityNotFound(_0x58c68a,null))['then'](saveUpdates(_0x11bf6f[_0x385218('0x0')],null))['then'](respondWithResult(_0x58c68a,null))[_0x385218('0x1d')](handleError(_0x58c68a,null));},exports['destroy']=function(_0x29139b,_0x5df72d){const _0x110007=_0x32dc91;return db[_0x110007('0x30')][_0x110007('0x11')]({'where':{'id':_0x29139b[_0x110007('0x2e')]['id']}})[_0x110007('0xb')](handleEntityNotFound(_0x5df72d,null))[_0x110007('0xb')](removeEntity(_0x5df72d,null))[_0x110007('0x1d')](handleError(_0x5df72d,null));},exports[_0x32dc91('0x1a')]=function(_0x1571b6,_0x155312){const _0x2b882e=_0x32dc91;return db[_0x2b882e('0x30')][_0x2b882e('0x1a')]()[_0x2b882e('0xb')](respondWithResult(_0x155312,null))[_0x2b882e('0x1d')](handleError(_0x155312,null));};