Built motion from commit 973e3e332e1c8e2f84c4b0cd2e5af794131724f5. Version 3.0.0...
[motion-next.git] / server / api / jscriptyQuestionReport / jscriptyQuestionReport.controller.js
1 const a382_0x220d=['stack','index','api','sort','pick','include','limit','length','catch','intersection','describe','type','params','merge','findOne','where','rawAttributes','destroy','send','name','show','fields','undefined','count','order','query','then','../../mysqldb','filters','body','attributes','Content-Range','model','options','nolimit','set','keys','map','sendStatus','like','offset','fieldName','rows','create','json','JscriptyQuestionReport','lodash','VIRTUAL','error','includeAll','update','status','filter','sequelize'];(function(_0x3d74a6,_0x220dab){const _0x42b974=function(_0xde7ad9){while(--_0xde7ad9){_0x3d74a6['push'](_0x3d74a6['shift']());}};_0x42b974(++_0x220dab);}(a382_0x220d,0x13c));const a382_0x42b9=function(_0x3d74a6,_0x220dab){_0x3d74a6=_0x3d74a6-0x0;let _0x42b974=a382_0x220d[_0x3d74a6];return _0x42b974;};const _0x2864b1=a382_0x42b9;'use strict';const _=require(_0x2864b1('0x0')),qs=require('../../components/parsers/qs'),logger=require('../../config/logger')(_0x2864b1('0xa')),db=require(_0x2864b1('0x23'))['db'],{Op}=require(_0x2864b1('0x7'));function respondWithResult(_0xde7ad9,_0x29fd1d){return _0x29fd1d=_0x29fd1d||0xc8,function(_0x92b86b){const _0x2a13b5=a382_0x42b9;if(_0x92b86b)return _0xde7ad9['status'](_0x29fd1d)[_0x2a13b5('0x34')](_0x92b86b);};}function respondWithFilteredResult(_0x1139b0,_0x2ff348){return function(_0x39be9d){const _0x3fe786=a382_0x42b9;if(_0x39be9d){const _0x220528=_0x39be9d[_0x3fe786('0x1f')],_0x2389a3=_0x2ff348[_0x3fe786('0x30')];let _0x26ebdf=_0x2ff348['offset']+_0x2ff348[_0x3fe786('0xe')],_0x7bfe9a;return _0x26ebdf>=_0x220528?(_0x26ebdf=_0x220528,_0x7bfe9a=0xc8):_0x7bfe9a=0xce,_0x1139b0[_0x3fe786('0x5')](_0x7bfe9a),_0x1139b0[_0x3fe786('0x2b')](_0x3fe786('0x27'),_0x2389a3+'-'+_0x26ebdf+'/'+_0x220528)[_0x3fe786('0x34')](_0x39be9d);}return null;};}function saveUpdates(_0x50b808){return function(_0x2c2031){if(_0x2c2031)return _0x2c2031['update'](_0x50b808)['then'](function(_0x171a5e){return _0x171a5e;});return null;};}function removeEntity(_0x3bd2c2){return function(_0x512e0e){const _0x4ef379=a382_0x42b9;if(_0x512e0e)return _0x512e0e[_0x4ef379('0x19')]()[_0x4ef379('0x22')](function(){const _0x11126f=_0x4ef379;_0x3bd2c2[_0x11126f('0x5')](0xcc)['end']();});};}function handleEntityNotFound(_0x1539f5){return function(_0x2d8fa){const _0x2a5909=a382_0x42b9;return!_0x2d8fa&&_0x1539f5[_0x2a5909('0x2e')](0x194),_0x2d8fa;};}function handleError(_0x439fb2,_0x307c93){return _0x307c93=_0x307c93||0x1f4,function(_0x43067e){const _0x123ca2=a382_0x42b9;logger[_0x123ca2('0x2')](_0x43067e[_0x123ca2('0x8')]),_0x43067e[_0x123ca2('0x1b')]&&delete _0x43067e[_0x123ca2('0x1b')],_0x439fb2[_0x123ca2('0x5')](_0x307c93)[_0x123ca2('0x1a')](_0x43067e);};}exports[_0x2864b1('0x9')]=function(_0x255658,_0x462370){const _0x55b486=_0x2864b1;let _0x1e2514={};const _0x25a6d5={},_0x910264={'count':0x0,'rows':[]},_0x50edd0=_['map'](db[_0x55b486('0x35')]['rawAttributes'],function(_0x516435){const _0x15574b=_0x55b486;return{'name':_0x516435[_0x15574b('0x31')],'type':_0x516435[_0x15574b('0x13')]['key']};});_0x25a6d5[_0x55b486('0x28')]=_[_0x55b486('0x2d')](_0x50edd0,_0x55b486('0x1b')),_0x25a6d5[_0x55b486('0x21')]=_['keys'](_0x255658[_0x55b486('0x21')]),_0x25a6d5[_0x55b486('0x24')]=_[_0x55b486('0x11')](_0x25a6d5[_0x55b486('0x28')],_0x25a6d5['query']),_0x1e2514[_0x55b486('0x26')]=_['intersection'](_0x25a6d5[_0x55b486('0x28')],qs[_0x55b486('0x1d')](_0x255658[_0x55b486('0x21')][_0x55b486('0x1d')])),_0x1e2514[_0x55b486('0x26')]=_0x1e2514[_0x55b486('0x26')][_0x55b486('0xf')]?_0x1e2514[_0x55b486('0x26')]:_0x25a6d5['model'];typeof _0x255658[_0x55b486('0x21')][_0x55b486('0x2a')]===_0x55b486('0x1e')&&(_0x1e2514[_0x55b486('0xe')]=qs[_0x55b486('0xe')](_0x255658['query'][_0x55b486('0xe')]),_0x1e2514[_0x55b486('0x30')]=qs['offset'](_0x255658[_0x55b486('0x21')][_0x55b486('0x30')]));_0x1e2514[_0x55b486('0x20')]=qs[_0x55b486('0xb')](_0x255658[_0x55b486('0x21')][_0x55b486('0xb')]),_0x1e2514['where']=qs['filters'](_[_0x55b486('0xc')](_0x255658[_0x55b486('0x21')],_0x25a6d5[_0x55b486('0x24')]),_0x50edd0);_0x255658[_0x55b486('0x21')][_0x55b486('0x6')]&&(_0x1e2514[_0x55b486('0x17')]=_[_0x55b486('0x15')](_0x1e2514[_0x55b486('0x17')],{[Op['or']]:_[_0x55b486('0x2d')](_0x50edd0,function(_0x499e7f){const _0x3c0bef=_0x55b486;if(_0x499e7f[_0x3c0bef('0x13')]!==_0x3c0bef('0x1')){const _0x1dca6a={};return _0x1dca6a[_0x499e7f['name']]={[Op[_0x3c0bef('0x2f')]]:'%'+_0x255658['query']['filter']+'%'},_0x1dca6a;}})}));_0x1e2514=_[_0x55b486('0x15')]({},_0x1e2514,_0x255658['options']);const _0x4a9a28={'where':_0x1e2514[_0x55b486('0x17')]};return db['JscriptyQuestionReport'][_0x55b486('0x1f')](_0x4a9a28)['then'](function(_0x41ad7b){const _0xaae386=_0x55b486;return _0x910264['count']=_0x41ad7b,_0x255658['query'][_0xaae386('0x3')]&&(_0x1e2514[_0xaae386('0xd')]=[{'all':!![]}]),db['JscriptyQuestionReport']['findAll'](_0x1e2514);})[_0x55b486('0x22')](function(_0x1b66ba){const _0x48db8b=_0x55b486;return _0x910264[_0x48db8b('0x32')]=_0x1b66ba,_0x910264;})[_0x55b486('0x22')](respondWithFilteredResult(_0x462370,_0x1e2514))[_0x55b486('0x10')](handleError(_0x462370,null));},exports[_0x2864b1('0x1c')]=function(_0x135004,_0x13fcae){const _0x423dfc=_0x2864b1;let _0x49144b={'raw':!![],'where':{'id':_0x135004['params']['id']}};const _0xbf40d7={};return _0xbf40d7[_0x423dfc('0x28')]=_[_0x423dfc('0x2c')](db[_0x423dfc('0x35')][_0x423dfc('0x18')]),_0xbf40d7[_0x423dfc('0x21')]=_[_0x423dfc('0x2c')](_0x135004[_0x423dfc('0x21')]),_0xbf40d7['filters']=_[_0x423dfc('0x11')](_0xbf40d7[_0x423dfc('0x28')],_0xbf40d7[_0x423dfc('0x21')]),_0x49144b['attributes']=_['intersection'](_0xbf40d7['model'],qs[_0x423dfc('0x1d')](_0x135004[_0x423dfc('0x21')]['fields'])),_0x49144b[_0x423dfc('0x26')]=_0x49144b[_0x423dfc('0x26')][_0x423dfc('0xf')]?_0x49144b[_0x423dfc('0x26')]:_0xbf40d7[_0x423dfc('0x28')],_0x135004[_0x423dfc('0x21')]['includeAll']&&(_0x49144b[_0x423dfc('0xd')]=[{'all':!![]}]),_0x49144b=_['merge']({},_0x49144b,_0x135004[_0x423dfc('0x29')]),db[_0x423dfc('0x35')]['findOne'](_0x49144b)[_0x423dfc('0x22')](handleEntityNotFound(_0x13fcae,null))[_0x423dfc('0x22')](respondWithResult(_0x13fcae,null))[_0x423dfc('0x10')](handleError(_0x13fcae,null));},exports[_0x2864b1('0x33')]=function(_0xcba6d6,_0x39a319){const _0x48e46e=_0x2864b1;return db['JscriptyQuestionReport'][_0x48e46e('0x33')](_0xcba6d6[_0x48e46e('0x25')],{})[_0x48e46e('0x22')](respondWithResult(_0x39a319,0xc9))['catch'](handleError(_0x39a319,null));},exports[_0x2864b1('0x4')]=function(_0x29ed60,_0x427ce0){const _0x1c8d35=_0x2864b1;return _0x29ed60[_0x1c8d35('0x25')]['id']&&delete _0x29ed60['body']['id'],db[_0x1c8d35('0x35')]['findOne']({'where':{'id':_0x29ed60[_0x1c8d35('0x14')]['id']}})[_0x1c8d35('0x22')](handleEntityNotFound(_0x427ce0,null))[_0x1c8d35('0x22')](saveUpdates(_0x29ed60[_0x1c8d35('0x25')],null))['then'](respondWithResult(_0x427ce0,null))[_0x1c8d35('0x10')](handleError(_0x427ce0,null));},exports[_0x2864b1('0x19')]=function(_0x157e09,_0x2d88a2){const _0x2bb17e=_0x2864b1;return db[_0x2bb17e('0x35')][_0x2bb17e('0x16')]({'where':{'id':_0x157e09[_0x2bb17e('0x14')]['id']}})[_0x2bb17e('0x22')](handleEntityNotFound(_0x2d88a2,null))[_0x2bb17e('0x22')](removeEntity(_0x2d88a2,null))[_0x2bb17e('0x10')](handleError(_0x2d88a2,null));},exports[_0x2864b1('0x12')]=function(_0x4320e,_0x5db368){const _0x3bf04b=_0x2864b1;return db[_0x3bf04b('0x35')][_0x3bf04b('0x12')]()[_0x3bf04b('0x22')](respondWithResult(_0x5db368,null))[_0x3bf04b('0x10')](handleError(_0x5db368,null));};