fce25df285ec74918bf2711346939b70777d0438
[motion-next.git] / server / api / squareReportDetail / squareReportDetail.controller.js
1 const a615_0x3577=['include','status','pick','limit','options','findOne','merge','like','query','../../components/parsers/qs','describe','count','error','where','rows','SquareDetailsReport','filter','then','nolimit','key','undefined','index','body','send','params','includeAll','show','length','intersection','create','model','end','keys','rawAttributes','sequelize','catch','fields','update','json','filters','order','fieldName','api','name','sort','attributes','lodash','offset','findAll','destroy','map','type'];(function(_0x1905fd,_0x357765){const _0x5dbc7c=function(_0x5609cc){while(--_0x5609cc){_0x1905fd['push'](_0x1905fd['shift']());}};_0x5dbc7c(++_0x357765);}(a615_0x3577,0x14d));const a615_0x5dbc=function(_0x1905fd,_0x357765){_0x1905fd=_0x1905fd-0x0;let _0x5dbc7c=a615_0x3577[_0x1905fd];return _0x5dbc7c;};const _0x10647b=a615_0x5dbc;'use strict';const _=require(_0x10647b('0x19')),qs=require(_0x10647b('0x28')),logger=require('../../config/logger')(_0x10647b('0x15')),db=require('../../mysqldb')['db'],{Op}=require(_0x10647b('0xd'));function respondWithResult(_0x5609cc,_0x28fd50){return _0x28fd50=_0x28fd50||0xc8,function(_0x2a14c6){const _0x406110=a615_0x5dbc;if(_0x2a14c6)return _0x5609cc['status'](_0x28fd50)[_0x406110('0x11')](_0x2a14c6);};}function respondWithFilteredResult(_0x552313,_0x41ae66){return function(_0x56919c){const _0x5f4641=a615_0x5dbc;if(_0x56919c){const _0x5d2522=_0x56919c[_0x5f4641('0x2a')],_0x1c3b85=_0x41ae66[_0x5f4641('0x1a')];let _0x572c94=_0x41ae66['offset']+_0x41ae66[_0x5f4641('0x22')],_0x49248a;return _0x572c94>=_0x5d2522?(_0x572c94=_0x5d2522,_0x49248a=0xc8):_0x49248a=0xce,_0x552313[_0x5f4641('0x20')](_0x49248a),_0x552313['set']('Content-Range',_0x1c3b85+'-'+_0x572c94+'/'+_0x5d2522)[_0x5f4641('0x11')](_0x56919c);}return null;};}function saveUpdates(_0x575973){return function(_0xdec52){const _0x1b00a3=a615_0x5dbc;if(_0xdec52)return _0xdec52[_0x1b00a3('0x10')](_0x575973)[_0x1b00a3('0x30')](function(_0x2b3b43){return _0x2b3b43;});return null;};}function removeEntity(_0x18504e){return function(_0x376d7d){const _0x4ecc72=a615_0x5dbc;if(_0x376d7d)return _0x376d7d[_0x4ecc72('0x1c')]()[_0x4ecc72('0x30')](function(){const _0x3e4d3f=_0x4ecc72;_0x18504e[_0x3e4d3f('0x20')](0xcc)[_0x3e4d3f('0xa')]();});};}function handleEntityNotFound(_0x4473db){return function(_0xd2f19f){return!_0xd2f19f&&_0x4473db['sendStatus'](0x194),_0xd2f19f;};}function handleError(_0x216026,_0x4309d6){return _0x4309d6=_0x4309d6||0x1f4,function(_0x114b02){const _0x474164=a615_0x5dbc;logger[_0x474164('0x2b')](_0x114b02['stack']),_0x114b02[_0x474164('0x16')]&&delete _0x114b02[_0x474164('0x16')],_0x216026[_0x474164('0x20')](_0x4309d6)[_0x474164('0x2')](_0x114b02);};}exports[_0x10647b('0x0')]=function(_0x3e056c,_0x82c2f2){const _0x34871e=_0x10647b;let _0x26a8e0={};const _0x56f23f={},_0x4e7184={'count':0x0,'rows':[]},_0x3b45c5=_[_0x34871e('0x1d')](db[_0x34871e('0x2e')]['rawAttributes'],function(_0x5c8430){const _0x28126b=_0x34871e;return{'name':_0x5c8430[_0x28126b('0x14')],'type':_0x5c8430[_0x28126b('0x1e')][_0x28126b('0x32')]};});_0x56f23f[_0x34871e('0x9')]=_[_0x34871e('0x1d')](_0x3b45c5,_0x34871e('0x16')),_0x56f23f['query']=_[_0x34871e('0xb')](_0x3e056c[_0x34871e('0x27')]),_0x56f23f[_0x34871e('0x12')]=_[_0x34871e('0x7')](_0x56f23f[_0x34871e('0x9')],_0x56f23f[_0x34871e('0x27')]),_0x26a8e0[_0x34871e('0x18')]=_[_0x34871e('0x7')](_0x56f23f[_0x34871e('0x9')],qs[_0x34871e('0xf')](_0x3e056c[_0x34871e('0x27')][_0x34871e('0xf')])),_0x26a8e0['attributes']=_0x26a8e0[_0x34871e('0x18')][_0x34871e('0x6')]?_0x26a8e0[_0x34871e('0x18')]:_0x56f23f['model'];typeof _0x3e056c[_0x34871e('0x27')][_0x34871e('0x31')]===_0x34871e('0x33')&&(_0x26a8e0['limit']=qs[_0x34871e('0x22')](_0x3e056c['query'][_0x34871e('0x22')]),_0x26a8e0[_0x34871e('0x1a')]=qs[_0x34871e('0x1a')](_0x3e056c[_0x34871e('0x27')]['offset']));_0x26a8e0[_0x34871e('0x13')]=qs['sort'](_0x3e056c[_0x34871e('0x27')][_0x34871e('0x17')]),_0x26a8e0[_0x34871e('0x2c')]=qs[_0x34871e('0x12')](_[_0x34871e('0x21')](_0x3e056c[_0x34871e('0x27')],_0x56f23f[_0x34871e('0x12')]),_0x3b45c5);_0x3e056c['query'][_0x34871e('0x2f')]&&(_0x26a8e0[_0x34871e('0x2c')]=_[_0x34871e('0x25')](_0x26a8e0[_0x34871e('0x2c')],{[Op['or']]:_[_0x34871e('0x1d')](_0x3b45c5,function(_0x5204bc){const _0x2cb318=_0x34871e;if(_0x5204bc[_0x2cb318('0x1e')]!=='VIRTUAL'){const _0xf617a9={};return _0xf617a9[_0x5204bc[_0x2cb318('0x16')]]={[Op[_0x2cb318('0x26')]]:'%'+_0x3e056c[_0x2cb318('0x27')][_0x2cb318('0x2f')]+'%'},_0xf617a9;}})}));_0x26a8e0=_['merge']({},_0x26a8e0,_0x3e056c['options']);const _0x1c5be7={'where':_0x26a8e0[_0x34871e('0x2c')]};return db[_0x34871e('0x2e')]['count'](_0x1c5be7)['then'](function(_0x25c9c1){const _0x1de1ac=_0x34871e;return _0x4e7184[_0x1de1ac('0x2a')]=_0x25c9c1,_0x3e056c[_0x1de1ac('0x27')][_0x1de1ac('0x4')]&&(_0x26a8e0[_0x1de1ac('0x1f')]=[{'all':!![]}]),db[_0x1de1ac('0x2e')][_0x1de1ac('0x1b')](_0x26a8e0);})['then'](function(_0x3dac02){const _0x1bafc1=_0x34871e;return _0x4e7184[_0x1bafc1('0x2d')]=_0x3dac02,_0x4e7184;})[_0x34871e('0x30')](respondWithFilteredResult(_0x82c2f2,_0x26a8e0))[_0x34871e('0xe')](handleError(_0x82c2f2,null));},exports[_0x10647b('0x5')]=function(_0x2a8215,_0x1a4186){const _0x5e6124=_0x10647b;let _0x1183d9={'raw':!![],'where':{'id':_0x2a8215[_0x5e6124('0x3')]['id']}};const _0x45211b={};return _0x45211b[_0x5e6124('0x9')]=_[_0x5e6124('0xb')](db[_0x5e6124('0x2e')][_0x5e6124('0xc')]),_0x45211b[_0x5e6124('0x27')]=_[_0x5e6124('0xb')](_0x2a8215[_0x5e6124('0x27')]),_0x45211b[_0x5e6124('0x12')]=_[_0x5e6124('0x7')](_0x45211b[_0x5e6124('0x9')],_0x45211b[_0x5e6124('0x27')]),_0x1183d9[_0x5e6124('0x18')]=_['intersection'](_0x45211b['model'],qs['fields'](_0x2a8215[_0x5e6124('0x27')][_0x5e6124('0xf')])),_0x1183d9[_0x5e6124('0x18')]=_0x1183d9['attributes'][_0x5e6124('0x6')]?_0x1183d9[_0x5e6124('0x18')]:_0x45211b[_0x5e6124('0x9')],_0x2a8215[_0x5e6124('0x27')][_0x5e6124('0x4')]&&(_0x1183d9[_0x5e6124('0x1f')]=[{'all':!![]}]),_0x1183d9=_[_0x5e6124('0x25')]({},_0x1183d9,_0x2a8215[_0x5e6124('0x23')]),db[_0x5e6124('0x2e')][_0x5e6124('0x24')](_0x1183d9)[_0x5e6124('0x30')](handleEntityNotFound(_0x1a4186,null))[_0x5e6124('0x30')](respondWithResult(_0x1a4186,null))['catch'](handleError(_0x1a4186,null));},exports[_0x10647b('0x8')]=function(_0x3f1add,_0x1c37fa){const _0x29b02a=_0x10647b;return db[_0x29b02a('0x2e')]['create'](_0x3f1add[_0x29b02a('0x1')],{})['then'](respondWithResult(_0x1c37fa,0xc9))['catch'](handleError(_0x1c37fa,null));},exports['update']=function(_0x3194b8,_0x338018){const _0x5ab75e=_0x10647b;return _0x3194b8['body']['id']&&delete _0x3194b8['body']['id'],db[_0x5ab75e('0x2e')][_0x5ab75e('0x24')]({'where':{'id':_0x3194b8[_0x5ab75e('0x3')]['id']}})[_0x5ab75e('0x30')](handleEntityNotFound(_0x338018,null))['then'](saveUpdates(_0x3194b8[_0x5ab75e('0x1')],null))[_0x5ab75e('0x30')](respondWithResult(_0x338018,null))[_0x5ab75e('0xe')](handleError(_0x338018,null));},exports[_0x10647b('0x1c')]=function(_0x5fcba1,_0x5a29c9){const _0x2f8424=_0x10647b;return db[_0x2f8424('0x2e')][_0x2f8424('0x24')]({'where':{'id':_0x5fcba1['params']['id']}})[_0x2f8424('0x30')](handleEntityNotFound(_0x5a29c9,null))[_0x2f8424('0x30')](removeEntity(_0x5a29c9,null))[_0x2f8424('0xe')](handleError(_0x5a29c9,null));},exports['describe']=function(_0x532f54,_0x41e459){const _0x4dc35c=_0x10647b;return db[_0x4dc35c('0x2e')][_0x4dc35c('0x29')]()[_0x4dc35c('0x30')](respondWithResult(_0x41e459,null))[_0x4dc35c('0xe')](handleError(_0x41e459,null));};