Built motion from commit b51cdcb3f2cb46634587ce1d55ea1b8f32dacea6. Version 3.0.0...
[motion-next.git] / server / api / squareReport / squareReport.controller.js
1 const a610_0x4803=['Content-Range','destroy','show','name','set','includeAll','json','intersection','error','nolimit','end','SquareReport','filters','type','api','query','model','findOne','keys','update','params','sendStatus','status','../../config/logger','catch','index','options','map','fieldName','../../components/parsers/qs','sequelize','where','create','like','then','filter','body','VIRTUAL','lodash','key','offset','fields','findAll','rawAttributes','include','attributes','merge','limit','length'];(function(_0x4d71f3,_0x480347){const _0x2f08a2=function(_0x1a6bee){while(--_0x1a6bee){_0x4d71f3['push'](_0x4d71f3['shift']());}};_0x2f08a2(++_0x480347);}(a610_0x4803,0x1c6));const a610_0x2f08=function(_0x4d71f3,_0x480347){_0x4d71f3=_0x4d71f3-0x0;let _0x2f08a2=a610_0x4803[_0x4d71f3];return _0x2f08a2;};const _0x437410=a610_0x2f08;'use strict';const _=require(_0x437410('0x19')),qs=require(_0x437410('0x10')),logger=require(_0x437410('0xa'))(_0x437410('0x1')),db=require('../../mysqldb')['db'],{Op}=require(_0x437410('0x11'));function respondWithResult(_0x1a6bee,_0x326b58){return _0x326b58=_0x326b58||0xc8,function(_0x50d1e){const _0x2be3c3=a610_0x2f08;if(_0x50d1e)return _0x1a6bee[_0x2be3c3('0x9')](_0x326b58)[_0x2be3c3('0x2a')](_0x50d1e);};}function respondWithFilteredResult(_0x363f8d,_0x1ebbbf){return function(_0x44bcfe){const _0x49c279=a610_0x2f08;if(_0x44bcfe){const _0x829ac2=_0x44bcfe['count'],_0x5c571e=_0x1ebbbf[_0x49c279('0x1b')];let _0x4a5b5b=_0x1ebbbf['offset']+_0x1ebbbf[_0x49c279('0x22')],_0xd55775;return _0x4a5b5b>=_0x829ac2?(_0x4a5b5b=_0x829ac2,_0xd55775=0xc8):_0xd55775=0xce,_0x363f8d['status'](_0xd55775),_0x363f8d[_0x49c279('0x28')](_0x49c279('0x24'),_0x5c571e+'-'+_0x4a5b5b+'/'+_0x829ac2)[_0x49c279('0x2a')](_0x44bcfe);}return null;};}function saveUpdates(_0x5927c6){return function(_0x2b3246){const _0x40d661=a610_0x2f08;if(_0x2b3246)return _0x2b3246['update'](_0x5927c6)[_0x40d661('0x15')](function(_0x4a6cbb){return _0x4a6cbb;});return null;};}function removeEntity(_0x458643){return function(_0xc313c0){const _0x21c45=a610_0x2f08;if(_0xc313c0)return _0xc313c0[_0x21c45('0x25')]()[_0x21c45('0x15')](function(){const _0x18317f=_0x21c45;_0x458643[_0x18317f('0x9')](0xcc)[_0x18317f('0x2e')]();});};}function handleEntityNotFound(_0x3c149c){return function(_0x16c32b){const _0x411d44=a610_0x2f08;return!_0x16c32b&&_0x3c149c[_0x411d44('0x8')](0x194),_0x16c32b;};}function handleError(_0x12a34b,_0x4198f9){return _0x4198f9=_0x4198f9||0x1f4,function(_0x2e2e22){const _0x372248=a610_0x2f08;logger[_0x372248('0x2c')](_0x2e2e22['stack']),_0x2e2e22['name']&&delete _0x2e2e22['name'],_0x12a34b[_0x372248('0x9')](_0x4198f9)['send'](_0x2e2e22);};}exports[_0x437410('0xc')]=function(_0x3e9fec,_0x33214a){const _0x2bc4e2=_0x437410;let _0x27748a={};const _0x4ba3ff={},_0x271356={'count':0x0,'rows':[]},_0x2cd0b9=_[_0x2bc4e2('0xe')](db[_0x2bc4e2('0x2f')][_0x2bc4e2('0x1e')],function(_0x557b73){const _0x3267d4=_0x2bc4e2;return{'name':_0x557b73[_0x3267d4('0xf')],'type':_0x557b73['type'][_0x3267d4('0x1a')]};});_0x4ba3ff['model']=_['map'](_0x2cd0b9,'name'),_0x4ba3ff[_0x2bc4e2('0x2')]=_[_0x2bc4e2('0x5')](_0x3e9fec[_0x2bc4e2('0x2')]),_0x4ba3ff[_0x2bc4e2('0x30')]=_['intersection'](_0x4ba3ff[_0x2bc4e2('0x3')],_0x4ba3ff[_0x2bc4e2('0x2')]),_0x27748a['attributes']=_[_0x2bc4e2('0x2b')](_0x4ba3ff[_0x2bc4e2('0x3')],qs[_0x2bc4e2('0x1c')](_0x3e9fec[_0x2bc4e2('0x2')]['fields'])),_0x27748a[_0x2bc4e2('0x20')]=_0x27748a[_0x2bc4e2('0x20')]['length']?_0x27748a[_0x2bc4e2('0x20')]:_0x4ba3ff[_0x2bc4e2('0x3')];typeof _0x3e9fec[_0x2bc4e2('0x2')][_0x2bc4e2('0x2d')]==='undefined'&&(_0x27748a[_0x2bc4e2('0x22')]=qs[_0x2bc4e2('0x22')](_0x3e9fec[_0x2bc4e2('0x2')][_0x2bc4e2('0x22')]),_0x27748a[_0x2bc4e2('0x1b')]=qs[_0x2bc4e2('0x1b')](_0x3e9fec[_0x2bc4e2('0x2')][_0x2bc4e2('0x1b')]));_0x27748a['order']=qs['sort'](_0x3e9fec[_0x2bc4e2('0x2')]['sort']),_0x27748a[_0x2bc4e2('0x12')]=qs[_0x2bc4e2('0x30')](_['pick'](_0x3e9fec[_0x2bc4e2('0x2')],_0x4ba3ff['filters']),_0x2cd0b9);_0x3e9fec[_0x2bc4e2('0x2')][_0x2bc4e2('0x16')]&&(_0x27748a[_0x2bc4e2('0x12')]=_[_0x2bc4e2('0x21')](_0x27748a[_0x2bc4e2('0x12')],{[Op['or']]:_[_0x2bc4e2('0xe')](_0x2cd0b9,function(_0x1d159b){const _0x49ecd8=_0x2bc4e2;if(_0x1d159b[_0x49ecd8('0x0')]!==_0x49ecd8('0x18')){const _0x3b653d={};return _0x3b653d[_0x1d159b[_0x49ecd8('0x27')]]={[Op[_0x49ecd8('0x14')]]:'%'+_0x3e9fec[_0x49ecd8('0x2')]['filter']+'%'},_0x3b653d;}})}));_0x27748a=_[_0x2bc4e2('0x21')]({},_0x27748a,_0x3e9fec[_0x2bc4e2('0xd')]);const _0x26adfb={'where':_0x27748a[_0x2bc4e2('0x12')]};return db[_0x2bc4e2('0x2f')]['count'](_0x26adfb)[_0x2bc4e2('0x15')](function(_0x4aee00){const _0x3a38ff=_0x2bc4e2;return _0x271356['count']=_0x4aee00,_0x3e9fec[_0x3a38ff('0x2')][_0x3a38ff('0x29')]&&(_0x27748a[_0x3a38ff('0x1f')]=[{'all':!![]}]),db['SquareReport'][_0x3a38ff('0x1d')](_0x27748a);})[_0x2bc4e2('0x15')](function(_0x1d7778){return _0x271356['rows']=_0x1d7778,_0x271356;})[_0x2bc4e2('0x15')](respondWithFilteredResult(_0x33214a,_0x27748a))[_0x2bc4e2('0xb')](handleError(_0x33214a,null));},exports[_0x437410('0x26')]=function(_0x5af9fd,_0x360cbd){const _0x214a3e=_0x437410;let _0x5d3bc0={'raw':!![],'where':{'id':_0x5af9fd[_0x214a3e('0x7')]['id']}};const _0x1f9317={};return _0x1f9317[_0x214a3e('0x3')]=_['keys'](db[_0x214a3e('0x2f')][_0x214a3e('0x1e')]),_0x1f9317['query']=_[_0x214a3e('0x5')](_0x5af9fd[_0x214a3e('0x2')]),_0x1f9317['filters']=_[_0x214a3e('0x2b')](_0x1f9317[_0x214a3e('0x3')],_0x1f9317['query']),_0x5d3bc0[_0x214a3e('0x20')]=_['intersection'](_0x1f9317[_0x214a3e('0x3')],qs[_0x214a3e('0x1c')](_0x5af9fd[_0x214a3e('0x2')][_0x214a3e('0x1c')])),_0x5d3bc0[_0x214a3e('0x20')]=_0x5d3bc0[_0x214a3e('0x20')][_0x214a3e('0x23')]?_0x5d3bc0[_0x214a3e('0x20')]:_0x1f9317[_0x214a3e('0x3')],_0x5af9fd[_0x214a3e('0x2')][_0x214a3e('0x29')]&&(_0x5d3bc0['include']=[{'all':!![]}]),_0x5d3bc0=_[_0x214a3e('0x21')]({},_0x5d3bc0,_0x5af9fd[_0x214a3e('0xd')]),db['SquareReport']['findOne'](_0x5d3bc0)[_0x214a3e('0x15')](handleEntityNotFound(_0x360cbd,null))[_0x214a3e('0x15')](respondWithResult(_0x360cbd,null))['catch'](handleError(_0x360cbd,null));},exports[_0x437410('0x13')]=function(_0x274848,_0x4d4daf){const _0x1775d2=_0x437410;return db[_0x1775d2('0x2f')][_0x1775d2('0x13')](_0x274848['body'],{})[_0x1775d2('0x15')](respondWithResult(_0x4d4daf,0xc9))[_0x1775d2('0xb')](handleError(_0x4d4daf,null));},exports[_0x437410('0x6')]=function(_0xe206c9,_0x5a6d43){const _0x1fd356=_0x437410;return _0xe206c9['body']['id']&&delete _0xe206c9[_0x1fd356('0x17')]['id'],db[_0x1fd356('0x2f')][_0x1fd356('0x4')]({'where':{'id':_0xe206c9[_0x1fd356('0x7')]['id']}})['then'](handleEntityNotFound(_0x5a6d43,null))[_0x1fd356('0x15')](saveUpdates(_0xe206c9[_0x1fd356('0x17')],null))['then'](respondWithResult(_0x5a6d43,null))[_0x1fd356('0xb')](handleError(_0x5a6d43,null));},exports[_0x437410('0x25')]=function(_0x5cf308,_0x53b57d){const _0x45b798=_0x437410;return db[_0x45b798('0x2f')][_0x45b798('0x4')]({'where':{'id':_0x5cf308[_0x45b798('0x7')]['id']}})[_0x45b798('0x15')](handleEntityNotFound(_0x53b57d,null))[_0x45b798('0x15')](removeEntity(_0x53b57d,null))[_0x45b798('0xb')](handleError(_0x53b57d,null));},exports['describe']=function(_0xae18df,_0x3efa99){const _0x576b39=_0x437410;return db[_0x576b39('0x2f')]['describe']()[_0x576b39('0x15')](respondWithResult(_0x3efa99,null))['catch'](handleError(_0x3efa99,null));};