Built motion from commit f861bcb808219e66da88ba48b61bddb35224a65e. Version 3.0.0...
[motion-next.git] / server / api / jscriptyAnswerReport / jscriptyAnswerReport.controller.js
1 'use strict';const a450_0x1eeb=['status','nolimit','catch','743892sJthoC','includeAll','send','create','error','show','map','body','@utils/filter-attributes','6lGJMVy','rawAttributes','Content-Range','api','json','fields','433212VucbwH','@mysqldb','offset','findOne','params','4451EzcEVN','3EATVQB','merge','limit','model','attributes','@config/logger','key','update','index','sendStatus','JscriptyAnswerReport','rows','query','146zEseAu','describe','options','type','605878cspYZl','intersection','where','then','filters','length','set','destroy','sort','200372uEJphZ','count','undefined','pick','order','51529DSGfgS','keys','60371MZVvwm'];const a450_0x2829=function(_0x1f05cf,_0x5e912e){_0x1f05cf=_0x1f05cf-0x197;let _0x1eebef=a450_0x1eeb[_0x1f05cf];return _0x1eebef;};const a450_0x435ba9=a450_0x2829;(function(_0x3983ed,_0x264300){const _0x535c97=a450_0x2829;while(!![]){try{const _0x2ae1ba=parseInt(_0x535c97(0x1d0))+parseInt(_0x535c97(0x1ae))*parseInt(_0x535c97(0x1bc))+parseInt(_0x535c97(0x1c9))*parseInt(_0x535c97(0x1af))+parseInt(_0x535c97(0x1c0))+-parseInt(_0x535c97(0x1a3))*parseInt(_0x535c97(0x1ce))+-parseInt(_0x535c97(0x1a9))+-parseInt(_0x535c97(0x19a));if(_0x2ae1ba===_0x264300)break;else _0x3983ed['push'](_0x3983ed['shift']());}catch(_0x59369b){_0x3983ed['push'](_0x3983ed['shift']());}}}(a450_0x1eeb,0x69355));const _=require('lodash'),qs=require('@components/parsers/qs'),logger=require(a450_0x435ba9(0x1b4))(a450_0x435ba9(0x1a6)),{db}=require(a450_0x435ba9(0x1aa)),{filterAttributes}=require(a450_0x435ba9(0x1a2));function respondWithResult(_0x3ad0af,_0x435d6c){return _0x435d6c=_0x435d6c||0xc8,function(_0x3bfeb3){const _0x1d4c7a=a450_0x2829;if(_0x3bfeb3)return _0x3ad0af[_0x1d4c7a(0x197)](_0x435d6c)[_0x1d4c7a(0x1a7)](_0x3bfeb3);};}function respondWithFilteredResult(_0x13b69c,_0xc8aa28){return function(_0x4988e3){const _0x5e7331=a450_0x2829;if(_0x4988e3){const _0x999c2e=_0x4988e3[_0x5e7331(0x1ca)],_0x2f5585=_0xc8aa28[_0x5e7331(0x1ab)];let _0x561722=_0xc8aa28[_0x5e7331(0x1ab)]+_0xc8aa28[_0x5e7331(0x1b1)],_0x53f81a;return _0x561722>=_0x999c2e?(_0x561722=_0x999c2e,_0x53f81a=0xc8):_0x53f81a=0xce,_0x13b69c[_0x5e7331(0x197)](_0x53f81a),_0x13b69c[_0x5e7331(0x1c6)](_0x5e7331(0x1a5),_0x2f5585+'-'+_0x561722+'/'+_0x999c2e)[_0x5e7331(0x1a7)](_0x4988e3);}return null;};}function saveUpdates(_0x202d92){return function(_0x33d55f){const _0x52c2ac=a450_0x2829;if(_0x33d55f)return _0x33d55f['update'](_0x202d92)[_0x52c2ac(0x1c3)](function(_0x45ebeb){return _0x45ebeb;});return null;};}function removeEntity(_0xbc9a36){return function(_0x10dacd){const _0x55af9b=a450_0x2829;if(_0x10dacd)return _0x10dacd[_0x55af9b(0x1c7)]()[_0x55af9b(0x1c3)](function(){const _0x28154f=_0x55af9b;_0xbc9a36[_0x28154f(0x197)](0xcc)['end']();});};}function handleEntityNotFound(_0xcfafd4){return function(_0x14d265){const _0x3cf752=a450_0x2829;return!_0x14d265&&_0xcfafd4[_0x3cf752(0x1b8)](0x194),_0x14d265;};}function handleError(_0x5c5d03,_0x1debd3){return _0x1debd3=_0x1debd3||0x1f4,function(_0x9451cb){const _0x5e1e58=a450_0x2829;logger[_0x5e1e58(0x19e)](_0x9451cb['stack']),_0x9451cb['name']&&delete _0x9451cb['name'],_0x5c5d03[_0x5e1e58(0x197)](_0x1debd3)[_0x5e1e58(0x19c)](_0x9451cb);};}exports[a450_0x435ba9(0x1b7)]=function(_0x2126fd,_0x1a248b){const _0x444460=a450_0x435ba9;let _0x35ff39={};const _0x32fc87={},_0x35f9a2={'count':0x0,'rows':[]},_0x53d452=_[_0x444460(0x1a0)](db['JscriptyAnswerReport']['rawAttributes'],function(_0x899ea2){const _0x3cc2c1=_0x444460;return{'name':_0x899ea2['fieldName'],'type':_0x899ea2[_0x3cc2c1(0x1bf)][_0x3cc2c1(0x1b5)]};});_0x32fc87[_0x444460(0x1b2)]=_[_0x444460(0x1a0)](_0x53d452,'name'),_0x32fc87[_0x444460(0x1bb)]=_['keys'](_0x2126fd[_0x444460(0x1bb)]),_0x32fc87[_0x444460(0x1c4)]=_[_0x444460(0x1c1)](_0x32fc87[_0x444460(0x1b2)],_0x32fc87[_0x444460(0x1bb)]),_0x35ff39[_0x444460(0x1b3)]=_[_0x444460(0x1c1)](_0x32fc87[_0x444460(0x1b2)],qs[_0x444460(0x1a8)](_0x2126fd[_0x444460(0x1bb)]['fields'])),_0x35ff39['attributes']=_0x35ff39[_0x444460(0x1b3)][_0x444460(0x1c5)]?_0x35ff39[_0x444460(0x1b3)]:_0x32fc87[_0x444460(0x1b2)];typeof _0x2126fd[_0x444460(0x1bb)][_0x444460(0x198)]===_0x444460(0x1cb)&&(_0x35ff39[_0x444460(0x1b1)]=qs[_0x444460(0x1b1)](_0x2126fd['query'][_0x444460(0x1b1)]),_0x35ff39[_0x444460(0x1ab)]=qs[_0x444460(0x1ab)](_0x2126fd[_0x444460(0x1bb)][_0x444460(0x1ab)]));_0x35ff39[_0x444460(0x1cd)]=qs[_0x444460(0x1c8)](_0x2126fd[_0x444460(0x1bb)]['sort']),_0x35ff39['where']=qs[_0x444460(0x1c4)](_[_0x444460(0x1cc)](_0x2126fd[_0x444460(0x1bb)],_0x32fc87[_0x444460(0x1c4)]),_0x53d452),_0x35ff39=filterAttributes(_0x35ff39,_0x2126fd[_0x444460(0x1bb)]['filter'],_0x53d452,_0x2126fd['options']);const _0x3471fa={'where':_0x35ff39[_0x444460(0x1c2)]};return db[_0x444460(0x1b9)][_0x444460(0x1ca)](_0x3471fa)[_0x444460(0x1c3)](function(_0x2b7a5b){const _0x500730=_0x444460;return _0x35f9a2[_0x500730(0x1ca)]=_0x2b7a5b,_0x2126fd[_0x500730(0x1bb)][_0x500730(0x19b)]&&(_0x35ff39['include']=[{'all':!![]}]),db[_0x500730(0x1b9)]['findAll'](_0x35ff39);})[_0x444460(0x1c3)](function(_0x58372e){const _0x4fbcbf=_0x444460;return _0x35f9a2[_0x4fbcbf(0x1ba)]=_0x58372e,_0x35f9a2;})['then'](respondWithFilteredResult(_0x1a248b,_0x35ff39))[_0x444460(0x199)](handleError(_0x1a248b,null));},exports[a450_0x435ba9(0x19f)]=function(_0x5e1a3e,_0x4c4e0f){const _0x3e8e12=a450_0x435ba9;let _0x4e0d76={'raw':!![],'where':{'id':_0x5e1a3e[_0x3e8e12(0x1ad)]['id']}};const _0xad0037={};return _0xad0037[_0x3e8e12(0x1b2)]=_[_0x3e8e12(0x1cf)](db['JscriptyAnswerReport'][_0x3e8e12(0x1a4)]),_0xad0037[_0x3e8e12(0x1bb)]=_[_0x3e8e12(0x1cf)](_0x5e1a3e[_0x3e8e12(0x1bb)]),_0xad0037[_0x3e8e12(0x1c4)]=_[_0x3e8e12(0x1c1)](_0xad0037[_0x3e8e12(0x1b2)],_0xad0037[_0x3e8e12(0x1bb)]),_0x4e0d76['attributes']=_['intersection'](_0xad0037['model'],qs['fields'](_0x5e1a3e[_0x3e8e12(0x1bb)][_0x3e8e12(0x1a8)])),_0x4e0d76[_0x3e8e12(0x1b3)]=_0x4e0d76[_0x3e8e12(0x1b3)][_0x3e8e12(0x1c5)]?_0x4e0d76[_0x3e8e12(0x1b3)]:_0xad0037[_0x3e8e12(0x1b2)],_0x5e1a3e['query'][_0x3e8e12(0x19b)]&&(_0x4e0d76['include']=[{'all':!![]}]),_0x4e0d76=_[_0x3e8e12(0x1b0)]({},_0x4e0d76,_0x5e1a3e[_0x3e8e12(0x1be)]),db[_0x3e8e12(0x1b9)]['findOne'](_0x4e0d76)[_0x3e8e12(0x1c3)](handleEntityNotFound(_0x4c4e0f,null))[_0x3e8e12(0x1c3)](respondWithResult(_0x4c4e0f,null))['catch'](handleError(_0x4c4e0f,null));},exports[a450_0x435ba9(0x19d)]=function(_0x2c6dbb,_0x2cdd16){const _0x3afc24=a450_0x435ba9;return db[_0x3afc24(0x1b9)][_0x3afc24(0x19d)](_0x2c6dbb[_0x3afc24(0x1a1)],{})[_0x3afc24(0x1c3)](respondWithResult(_0x2cdd16,0xc9))[_0x3afc24(0x199)](handleError(_0x2cdd16,null));},exports[a450_0x435ba9(0x1b6)]=function(_0x50c24b,_0x399efd){const _0x39b989=a450_0x435ba9;return _0x50c24b[_0x39b989(0x1a1)]['id']&&delete _0x50c24b['body']['id'],db[_0x39b989(0x1b9)][_0x39b989(0x1ac)]({'where':{'id':_0x50c24b[_0x39b989(0x1ad)]['id']}})['then'](handleEntityNotFound(_0x399efd,null))[_0x39b989(0x1c3)](saveUpdates(_0x50c24b[_0x39b989(0x1a1)],null))[_0x39b989(0x1c3)](respondWithResult(_0x399efd,null))[_0x39b989(0x199)](handleError(_0x399efd,null));},exports['destroy']=function(_0x5c0601,_0x2a25ba){const _0x440188=a450_0x435ba9;return db[_0x440188(0x1b9)][_0x440188(0x1ac)]({'where':{'id':_0x5c0601[_0x440188(0x1ad)]['id']}})[_0x440188(0x1c3)](handleEntityNotFound(_0x2a25ba,null))[_0x440188(0x1c3)](removeEntity(_0x2a25ba,null))['catch'](handleError(_0x2a25ba,null));},exports['describe']=function(_0x1b7bc3,_0x4c3da0){const _0x47a55d=a450_0x435ba9;return db['JscriptyAnswerReport'][_0x47a55d(0x1bd)]()[_0x47a55d(0x1c3)](respondWithResult(_0x4c3da0,null))['catch'](handleError(_0x4c3da0,null));};