Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / squareProject / squareProject.controller.js
index 94604c8..3411176 100644 (file)
@@ -1 +1 @@
-const a598_0x478b=['removeUsers','getUsers','count','user','role','findAll','end','api','emit','catch','params','includeAll','intersection','attributes','fields','SquareProject','undefined','../../mysqldb','VIRTUAL','key','create','error','set','send','sort','get','pick','model','like','sendStatus','include','query','Unable\x20to\x20retrieve\x20the\x20current\x20user','keys','offset','lodash','limit','omit','addUsers','order','destroy','merge','filters','userProfileId','UserProfileSection','show','body','userSquareProject:remove','../../config/logger','findOne','rawAttributes','where','index','update','UserProfileResource','filter','nolimit','map','length','then','rows','isArray','autoAssociation','SquareProjects','name','json','options','status','ids'];(function(_0x4a9841,_0x478b07){const _0x57d764=function(_0x22eecb){while(--_0x22eecb){_0x4a9841['push'](_0x4a9841['shift']());}};_0x57d764(++_0x478b07);}(a598_0x478b,0xae));const a598_0x57d7=function(_0x4a9841,_0x478b07){_0x4a9841=_0x4a9841-0x0;let _0x57d764=a598_0x478b[_0x4a9841];return _0x57d764;};const _0x50a2ab=a598_0x57d7;'use strict';const _=require(_0x50a2ab('0x44')),qs=require('../../components/parsers/qs'),logger=require(_0x50a2ab('0xc'))(_0x50a2ab('0x28')),{getSocket}=require('../../rediscache'),socket=getSocket(),db=require(_0x50a2ab('0x32'))['db'],{Op}=require('sequelize');require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x22eecb,_0x418ad8){return _0x418ad8=_0x418ad8||0xcc,function(_0x5dcb62){const _0x40d6ef=a598_0x57d7;if(_0x5dcb62)return _0x22eecb['sendStatus'](_0x418ad8);return _0x22eecb[_0x40d6ef('0x1f')](_0x418ad8)['end']();};}function respondWithResult(_0x441e30,_0x481a){return _0x481a=_0x481a||0xc8,function(_0x35a9ad){const _0x4d515e=a598_0x57d7;if(_0x35a9ad)return _0x441e30[_0x4d515e('0x1f')](_0x481a)['json'](_0x35a9ad);};}function respondWithFilteredResult(_0x49c08d,_0x1f9b92){return function(_0x418646){const _0x4d4a0b=a598_0x57d7;if(_0x418646){const _0x3be3c5=_0x418646['count'],_0x3991c9=_0x1f9b92[_0x4d4a0b('0x43')];let _0x24b7a9=_0x1f9b92[_0x4d4a0b('0x43')]+_0x1f9b92[_0x4d4a0b('0x0')],_0x1995e6;return _0x24b7a9>=_0x3be3c5?(_0x24b7a9=_0x3be3c5,_0x1995e6=0xc8):_0x1995e6=0xce,_0x49c08d[_0x4d4a0b('0x1f')](_0x1995e6),_0x49c08d[_0x4d4a0b('0x37')]('Content-Range',_0x3991c9+'-'+_0x24b7a9+'/'+_0x3be3c5)[_0x4d4a0b('0x1d')](_0x418646);}return null;};}function saveUpdates(_0x447118){return function(_0xf46ce9){const _0x149cdd=a598_0x57d7;if(_0xf46ce9)return _0xf46ce9[_0x149cdd('0x11')](_0x447118)[_0x149cdd('0x17')](function(_0x60b57f){return _0x60b57f;});return null;};}function removeEntity(_0x16103c){return function(_0x56c21b){const _0x20d8fa=a598_0x57d7;if(_0x56c21b)return _0x56c21b[_0x20d8fa('0x4')]()['then'](function(){const _0x31914d=_0x20d8fa,_0x44f088=_0x56c21b[_0x31914d('0x3a')]({'plain':!![]}),_0x5d2877=_0x31914d('0x1b');return db[_0x31914d('0x12')][_0x31914d('0x4')]({'where':{'type':_0x5d2877,'resourceId':_0x44f088['id']}})[_0x31914d('0x17')](function(){return _0x56c21b;});})['then'](function(){const _0x21218d=_0x20d8fa;_0x16103c['status'](0xcc)[_0x21218d('0x27')]();});};}function handleEntityNotFound(_0x47ae78){return function(_0xeed46f){const _0x1229eb=a598_0x57d7;return!_0xeed46f&&_0x47ae78[_0x1229eb('0x3e')](0x194),_0xeed46f;};}function handleError(_0x3d1b46,_0x36a690){return _0x36a690=_0x36a690||0x1f4,function(_0x1af050){const _0x24d663=a598_0x57d7;logger['error'](_0x1af050['stack']),_0x1af050['name']&&delete _0x1af050[_0x24d663('0x1c')],_0x3d1b46[_0x24d663('0x1f')](_0x36a690)[_0x24d663('0x38')](_0x1af050);};}exports[_0x50a2ab('0x10')]=function(_0x5094e5,_0x24629a){const _0x15cb47=_0x50a2ab;let _0x5d68d9={};const _0x9edd86={},_0x3e3922={'count':0x0,'rows':[]},_0x24d682=_[_0x15cb47('0x15')](db[_0x15cb47('0x30')][_0x15cb47('0xe')],function(_0x3d3878){const _0x9e9334=_0x15cb47;return{'name':_0x3d3878['fieldName'],'type':_0x3d3878['type'][_0x9e9334('0x34')]};});_0x9edd86[_0x15cb47('0x3c')]=_[_0x15cb47('0x15')](_0x24d682,'name'),_0x9edd86[_0x15cb47('0x40')]=_['keys'](_0x5094e5[_0x15cb47('0x40')]),_0x9edd86['filters']=_[_0x15cb47('0x2d')](_0x9edd86[_0x15cb47('0x3c')],_0x9edd86[_0x15cb47('0x40')]),_0x5d68d9[_0x15cb47('0x2e')]=_['intersection'](_0x9edd86[_0x15cb47('0x3c')],qs[_0x15cb47('0x2f')](_0x5094e5['query'][_0x15cb47('0x2f')])),_0x5d68d9[_0x15cb47('0x2e')]=_0x5d68d9['attributes'][_0x15cb47('0x16')]?_0x5d68d9['attributes']:_0x9edd86['model'];typeof _0x5094e5[_0x15cb47('0x40')]['nolimit']===_0x15cb47('0x31')&&(_0x5d68d9[_0x15cb47('0x0')]=qs[_0x15cb47('0x0')](_0x5094e5['query']['limit']),_0x5d68d9['offset']=qs['offset'](_0x5094e5[_0x15cb47('0x40')][_0x15cb47('0x43')]));_0x5d68d9[_0x15cb47('0x3')]=qs[_0x15cb47('0x39')](_0x5094e5['query'][_0x15cb47('0x39')]),_0x5d68d9[_0x15cb47('0xf')]=qs[_0x15cb47('0x6')](_['pick'](_0x5094e5[_0x15cb47('0x40')],_0x9edd86[_0x15cb47('0x6')]),_0x24d682);_0x5094e5[_0x15cb47('0x40')][_0x15cb47('0x13')]&&(_0x5d68d9[_0x15cb47('0xf')]=_[_0x15cb47('0x5')](_0x5d68d9['where'],{[Op['or']]:_[_0x15cb47('0x15')](_0x24d682,function(_0x47b1ec){const _0x1fa57a=_0x15cb47;if(_0x47b1ec['type']!==_0x1fa57a('0x33')){const _0x3bc0cb={};return _0x3bc0cb[_0x47b1ec[_0x1fa57a('0x1c')]]={[Op['like']]:'%'+_0x5094e5[_0x1fa57a('0x40')]['filter']+'%'},_0x3bc0cb;}})}));_0x5d68d9=_[_0x15cb47('0x5')]({},_0x5d68d9,_0x5094e5['options']);const _0x416480={'where':_0x5d68d9[_0x15cb47('0xf')]};return db[_0x15cb47('0x30')][_0x15cb47('0x23')](_0x416480)[_0x15cb47('0x17')](function(_0x2ab754){const _0x33b0a6=_0x15cb47;return _0x3e3922[_0x33b0a6('0x23')]=_0x2ab754,_0x5094e5[_0x33b0a6('0x40')][_0x33b0a6('0x2c')]&&(_0x5d68d9[_0x33b0a6('0x3f')]=[{'all':!![]}]),db[_0x33b0a6('0x30')][_0x33b0a6('0x26')](_0x5d68d9);})[_0x15cb47('0x17')](function(_0x5342a2){const _0x4c4a33=_0x15cb47;return _0x3e3922[_0x4c4a33('0x18')]=_0x5342a2,_0x3e3922;})[_0x15cb47('0x17')](respondWithFilteredResult(_0x24629a,_0x5d68d9))[_0x15cb47('0x2a')](handleError(_0x24629a,null));},exports[_0x50a2ab('0x9')]=function(_0x22315a,_0x2c1b2f){const _0x5dbfab=_0x50a2ab;let _0x35347c={'raw':![],'where':{'id':_0x22315a[_0x5dbfab('0x2b')]['id']}};const _0x344567={};return _0x344567[_0x5dbfab('0x3c')]=_[_0x5dbfab('0x42')](db['SquareProject'][_0x5dbfab('0xe')]),_0x344567[_0x5dbfab('0x40')]=_[_0x5dbfab('0x42')](_0x22315a[_0x5dbfab('0x40')]),_0x344567[_0x5dbfab('0x6')]=_[_0x5dbfab('0x2d')](_0x344567[_0x5dbfab('0x3c')],_0x344567[_0x5dbfab('0x40')]),_0x35347c[_0x5dbfab('0x2e')]=_[_0x5dbfab('0x2d')](_0x344567[_0x5dbfab('0x3c')],qs[_0x5dbfab('0x2f')](_0x22315a['query'][_0x5dbfab('0x2f')])),_0x35347c[_0x5dbfab('0x2e')]=_0x35347c[_0x5dbfab('0x2e')][_0x5dbfab('0x16')]?_0x35347c[_0x5dbfab('0x2e')]:_0x344567[_0x5dbfab('0x3c')],_0x22315a[_0x5dbfab('0x40')][_0x5dbfab('0x2c')]&&(_0x35347c[_0x5dbfab('0x3f')]=[{'all':!![]}]),_0x35347c=_[_0x5dbfab('0x5')]({},_0x35347c,_0x22315a[_0x5dbfab('0x1e')]),db[_0x5dbfab('0x30')][_0x5dbfab('0xd')](_0x35347c)[_0x5dbfab('0x17')](handleEntityNotFound(_0x2c1b2f,null))[_0x5dbfab('0x17')](respondWithResult(_0x2c1b2f,null))['catch'](handleError(_0x2c1b2f,null));},exports[_0x50a2ab('0x35')]=function(_0x4215a0,_0x6a7074){const _0x5d48e0=_0x50a2ab;return db[_0x5d48e0('0x30')][_0x5d48e0('0x35')](_0x4215a0[_0x5d48e0('0xa')],{})[_0x5d48e0('0x17')](function(_0x4e5213){const _0x133f3d=_0x5d48e0,_0x514a69=_0x4215a0[_0x133f3d('0x24')][_0x133f3d('0x3a')]({'plain':!![]});if(!_0x514a69)throw new Error(_0x133f3d('0x41'));if(_0x514a69[_0x133f3d('0x25')]===_0x133f3d('0x24')){const _0xee1e3f=_0x4e5213[_0x133f3d('0x3a')]({'plain':!![]}),_0x569d50='SquareProjects';return db[_0x133f3d('0x8')][_0x133f3d('0xd')]({'where':{'name':_0x569d50,'userProfileId':_0x514a69[_0x133f3d('0x7')]},'raw':!![]})[_0x133f3d('0x17')](function(_0x3d80a8){const _0x20e97a=_0x133f3d;return _0x3d80a8&&_0x3d80a8[_0x20e97a('0x1a')]===0x0?db[_0x20e97a('0x12')][_0x20e97a('0x35')]({'name':_0xee1e3f['name'],'resourceId':_0xee1e3f['id'],'type':_0x3d80a8[_0x20e97a('0x1c')],'sectionId':_0x3d80a8['id']},{})['then'](function(){return _0x4e5213;}):_0x4e5213;})[_0x133f3d('0x2a')](function(_0x58aa3f){const _0x2ea3b3=_0x133f3d;logger[_0x2ea3b3('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58aa3f);throw _0x58aa3f;});}return _0x4e5213;})[_0x5d48e0('0x17')](respondWithResult(_0x6a7074,0xc9))[_0x5d48e0('0x2a')](handleError(_0x6a7074,null));},exports[_0x50a2ab('0x11')]=function(_0x348a44,_0x4bd85e){const _0x2b1d2c=_0x50a2ab;return _0x348a44[_0x2b1d2c('0xa')]['id']&&delete _0x348a44[_0x2b1d2c('0xa')]['id'],db[_0x2b1d2c('0x30')]['findOne']({'where':{'id':_0x348a44['params']['id']}})['then'](handleEntityNotFound(_0x4bd85e,null))[_0x2b1d2c('0x17')](saveUpdates(_0x348a44['body'],null))[_0x2b1d2c('0x17')](respondWithResult(_0x4bd85e,null))[_0x2b1d2c('0x2a')](handleError(_0x4bd85e,null));},exports['destroy']=function(_0x3fb2eb,_0x9b8806){const _0x1f9414=_0x50a2ab;return db['SquareProject']['findOne']({'where':{'id':_0x3fb2eb[_0x1f9414('0x2b')]['id']}})[_0x1f9414('0x17')](handleEntityNotFound(_0x9b8806,null))[_0x1f9414('0x17')](removeEntity(_0x9b8806,null))['catch'](handleError(_0x9b8806,null));},exports[_0x50a2ab('0x2')]=function(_0x9f167d,_0x4806e6){const _0x19d72f=_0x50a2ab;return db[_0x19d72f('0x30')]['findOne']({'where':{'id':_0x9f167d['params']['id']}})[_0x19d72f('0x17')](function(_0x58cab5){const _0x358a78=_0x19d72f;if(_0x58cab5)return _0x58cab5['addUsers'](_0x9f167d[_0x358a78('0xa')][_0x358a78('0x20')],{'through':_[_0x358a78('0x1')](_0x9f167d[_0x358a78('0xa')],[_0x358a78('0x20'),'id'])});})[_0x19d72f('0x17')](respondWithResult(_0x4806e6,null))['catch'](handleError(_0x4806e6,null));},exports[_0x50a2ab('0x21')]=function(_0x2745b0,_0x2d7a94){const _0x65c08f=_0x50a2ab;return db['SquareProject'][_0x65c08f('0xd')]({'where':{'id':_0x2745b0[_0x65c08f('0x2b')]['id']}})[_0x65c08f('0x17')](handleEntityNotFound(_0x2d7a94,null))['then'](function(_0x43ddbc){const _0x2cef53=_0x65c08f;if(_0x43ddbc)return _0x43ddbc[_0x2cef53('0x21')](_0x2745b0[_0x2cef53('0x40')][_0x2cef53('0x20')])[_0x2cef53('0x17')](function(){const _0x132ef5=_0x2cef53;if(_[_0x132ef5('0x19')](_0x2745b0[_0x132ef5('0x40')][_0x132ef5('0x20')]))for(let _0x3d1805=0x0;_0x3d1805<_0x2745b0['query']['ids'][_0x132ef5('0x16')];_0x3d1805+=0x1){socket['emit'](_0x132ef5('0xb'),{'UserId':Number(_0x2745b0[_0x132ef5('0x40')][_0x132ef5('0x20')][_0x3d1805]),'SquareProjectId':Number(_0x2745b0[_0x132ef5('0x2b')]['id'])});}else socket[_0x132ef5('0x29')](_0x132ef5('0xb'),{'UserId':Number(_0x2745b0[_0x132ef5('0x40')]['ids']),'SquareProjectId':Number(_0x2745b0['params']['id'])});});})[_0x65c08f('0x17')](respondWithStatusCode(_0x2d7a94,null))[_0x65c08f('0x2a')](handleError(_0x2d7a94,null));},exports[_0x50a2ab('0x22')]=function(_0x27742d,_0x5f1f69){const _0x121da2=_0x50a2ab;let _0xa3226e={};const _0x3eaa09={};let _0x549714,_0x3b0e02;return db[_0x121da2('0x30')][_0x121da2('0xd')]({'where':{'id':_0x27742d[_0x121da2('0x2b')]['id']}})[_0x121da2('0x17')](handleEntityNotFound(_0x5f1f69,null))['then'](function(_0x38df56){const _0x8b413b=_0x121da2;if(_0x38df56)return _0x549714=_0x38df56,_0x3eaa09[_0x8b413b('0x3c')]=_[_0x8b413b('0x42')](db['User']['rawAttributes']),_0x3eaa09[_0x8b413b('0x40')]=_[_0x8b413b('0x42')](_0x27742d['query']),_0x3eaa09['filters']=_[_0x8b413b('0x2d')](_0x3eaa09[_0x8b413b('0x3c')],_0x3eaa09[_0x8b413b('0x40')]),_0xa3226e[_0x8b413b('0x2e')]=_[_0x8b413b('0x2d')](_0x3eaa09['model'],qs[_0x8b413b('0x2f')](_0x27742d[_0x8b413b('0x40')]['fields'])),_0xa3226e[_0x8b413b('0x2e')]=_0xa3226e[_0x8b413b('0x2e')][_0x8b413b('0x16')]?_0xa3226e['attributes']:_0x3eaa09[_0x8b413b('0x3c')],_0xa3226e[_0x8b413b('0x3')]=qs[_0x8b413b('0x39')](_0x27742d[_0x8b413b('0x40')][_0x8b413b('0x39')]),_0xa3226e[_0x8b413b('0xf')]=qs['filters'](_[_0x8b413b('0x3b')](_0x27742d[_0x8b413b('0x40')],_0x3eaa09[_0x8b413b('0x6')])),_0x27742d['query'][_0x8b413b('0x13')]&&(_0xa3226e[_0x8b413b('0xf')]=_['merge'](_0xa3226e[_0x8b413b('0xf')],{[Op['or']]:_[_0x8b413b('0x15')](_0xa3226e[_0x8b413b('0x2e')],function(_0xd9d494){const _0x19a772=_0x8b413b,_0x54fdb1={};return _0x54fdb1[_0xd9d494]={[Op[_0x19a772('0x3d')]]:'%'+_0x27742d[_0x19a772('0x40')]['filter']+'%'},_0x54fdb1;})})),_0xa3226e=_[_0x8b413b('0x5')]({},_0xa3226e,_0x27742d[_0x8b413b('0x1e')]),_0x549714[_0x8b413b('0x22')](_0xa3226e);})[_0x121da2('0x17')](function(_0x506103){const _0x58bd40=_0x121da2;if(_0x506103)return _0x3b0e02=_0x506103[_0x58bd40('0x16')],typeof _0x27742d[_0x58bd40('0x40')][_0x58bd40('0x14')]==='undefined'&&(_0xa3226e[_0x58bd40('0x0')]=qs[_0x58bd40('0x0')](_0x27742d[_0x58bd40('0x40')][_0x58bd40('0x0')]),_0xa3226e['offset']=qs[_0x58bd40('0x43')](_0x27742d['query'][_0x58bd40('0x43')])),_0x549714[_0x58bd40('0x22')](_0xa3226e);})[_0x121da2('0x17')](function(_0x4a90e8){if(_0x4a90e8)return _0x4a90e8?{'count':_0x3b0e02,'rows':_0x4a90e8}:null;})[_0x121da2('0x17')](respondWithResult(_0x5f1f69,null))[_0x121da2('0x2a')](handleError(_0x5f1f69,null));};
\ No newline at end of file
+const a598_0x394c=['Content-Range','register','ids','userProfileId','model','rows','key','rawAttributes','addUsers','get','SquareProject','../../config/logger','../../rediscache','removeUsers','body','name','stack','then','sendStatus','include','update','../../mysqldb','map','filters','findAll','sort','VIRTUAL','query','length','json','catch','destroy','error','order','count','send','omit','undefined','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','isArray','userSquareProject:remove','keys','status','pick','params','where','SquareProjects','findOne','intersection','user','User','offset','end','nolimit','emit','attributes','includeAll','like','limit','filter','merge','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','sequelize','UserProfileSection','UserProfileResource','index','fields','../../components/parsers/qs','getUsers','type'];(function(_0x47a940,_0x394cdd){const _0x2b1dbd=function(_0x2ca80f){while(--_0x2ca80f){_0x47a940['push'](_0x47a940['shift']());}};_0x2b1dbd(++_0x394cdd);}(a598_0x394c,0xaa));const a598_0x2b1d=function(_0x47a940,_0x394cdd){_0x47a940=_0x47a940-0x0;let _0x2b1dbd=a598_0x394c[_0x47a940];return _0x2b1dbd;};const _0xe4247a=a598_0x2b1d;'use strict';const _=require('lodash'),qs=require(_0xe4247a('0x28')),logger=require(_0xe4247a('0x36'))('api'),{getSocket}=require(_0xe4247a('0x37')),socket=getSocket(),db=require(_0xe4247a('0x40'))['db'],{Op}=require(_0xe4247a('0x23'));require('./squareProject.socket')[_0xe4247a('0x2c')](socket);function respondWithStatusCode(_0x2ca80f,_0xa691a4){return _0xa691a4=_0xa691a4||0xcc,function(_0x27f93f){const _0x47609e=a598_0x2b1d;if(_0x27f93f)return _0x2ca80f['sendStatus'](_0xa691a4);return _0x2ca80f[_0x47609e('0xe')](_0xa691a4)[_0x47609e('0x18')]();};}function respondWithResult(_0x2e8b13,_0x9bd4fe){return _0x9bd4fe=_0x9bd4fe||0xc8,function(_0x20f34b){const _0x17be19=a598_0x2b1d;if(_0x20f34b)return _0x2e8b13[_0x17be19('0xe')](_0x9bd4fe)[_0x17be19('0x1')](_0x20f34b);};}function respondWithFilteredResult(_0xd63687,_0x147d3d){return function(_0x355451){const _0xb3197f=a598_0x2b1d;if(_0x355451){const _0x931269=_0x355451['count'],_0xd18096=_0x147d3d[_0xb3197f('0x17')];let _0x2f1628=_0x147d3d['offset']+_0x147d3d[_0xb3197f('0x1e')],_0x3a8558;return _0x2f1628>=_0x931269?(_0x2f1628=_0x931269,_0x3a8558=0xc8):_0x3a8558=0xce,_0xd63687['status'](_0x3a8558),_0xd63687['set'](_0xb3197f('0x2b'),_0xd18096+'-'+_0x2f1628+'/'+_0x931269)[_0xb3197f('0x1')](_0x355451);}return null;};}function saveUpdates(_0x334a44){return function(_0x16f36b){const _0x1b3737=a598_0x2b1d;if(_0x16f36b)return _0x16f36b['update'](_0x334a44)[_0x1b3737('0x3c')](function(_0x4f0127){return _0x4f0127;});return null;};}function removeEntity(_0x1b9cc7){return function(_0x3bcfe7){const _0x2d515e=a598_0x2b1d;if(_0x3bcfe7)return _0x3bcfe7[_0x2d515e('0x3')]()[_0x2d515e('0x3c')](function(){const _0x431621=_0x2d515e,_0x40ea57=_0x3bcfe7[_0x431621('0x34')]({'plain':!![]}),_0x3d972a=_0x431621('0x12');return db[_0x431621('0x25')]['destroy']({'where':{'type':_0x3d972a,'resourceId':_0x40ea57['id']}})[_0x431621('0x3c')](function(){return _0x3bcfe7;});})['then'](function(){const _0x5d2215=_0x2d515e;_0x1b9cc7[_0x5d2215('0xe')](0xcc)[_0x5d2215('0x18')]();});};}function handleEntityNotFound(_0x262033){return function(_0x395503){const _0x1b0947=a598_0x2b1d;return!_0x395503&&_0x262033[_0x1b0947('0x3d')](0x194),_0x395503;};}function handleError(_0x5acf29,_0x4bdf3f){return _0x4bdf3f=_0x4bdf3f||0x1f4,function(_0x24781d){const _0x790308=a598_0x2b1d;logger[_0x790308('0x4')](_0x24781d[_0x790308('0x3b')]),_0x24781d[_0x790308('0x3a')]&&delete _0x24781d[_0x790308('0x3a')],_0x5acf29[_0x790308('0xe')](_0x4bdf3f)[_0x790308('0x7')](_0x24781d);};}exports[_0xe4247a('0x26')]=function(_0x3c9a45,_0x5183fc){const _0x1bb835=_0xe4247a;let _0x42bdb9={};const _0x2e29a7={},_0x55cef4={'count':0x0,'rows':[]},_0x3037d7=_[_0x1bb835('0x41')](db[_0x1bb835('0x35')][_0x1bb835('0x32')],function(_0x3c696d){const _0x34810a=_0x1bb835;return{'name':_0x3c696d['fieldName'],'type':_0x3c696d[_0x34810a('0x2a')][_0x34810a('0x31')]};});_0x2e29a7[_0x1bb835('0x2f')]=_[_0x1bb835('0x41')](_0x3037d7,'name'),_0x2e29a7[_0x1bb835('0x46')]=_[_0x1bb835('0xd')](_0x3c9a45['query']),_0x2e29a7['filters']=_['intersection'](_0x2e29a7[_0x1bb835('0x2f')],_0x2e29a7['query']),_0x42bdb9[_0x1bb835('0x1b')]=_[_0x1bb835('0x14')](_0x2e29a7[_0x1bb835('0x2f')],qs[_0x1bb835('0x27')](_0x3c9a45[_0x1bb835('0x46')][_0x1bb835('0x27')])),_0x42bdb9['attributes']=_0x42bdb9['attributes'][_0x1bb835('0x0')]?_0x42bdb9['attributes']:_0x2e29a7[_0x1bb835('0x2f')];typeof _0x3c9a45[_0x1bb835('0x46')][_0x1bb835('0x19')]==='undefined'&&(_0x42bdb9[_0x1bb835('0x1e')]=qs['limit'](_0x3c9a45[_0x1bb835('0x46')][_0x1bb835('0x1e')]),_0x42bdb9[_0x1bb835('0x17')]=qs['offset'](_0x3c9a45[_0x1bb835('0x46')][_0x1bb835('0x17')]));_0x42bdb9[_0x1bb835('0x5')]=qs[_0x1bb835('0x44')](_0x3c9a45[_0x1bb835('0x46')]['sort']),_0x42bdb9[_0x1bb835('0x11')]=qs[_0x1bb835('0x42')](_[_0x1bb835('0xf')](_0x3c9a45[_0x1bb835('0x46')],_0x2e29a7['filters']),_0x3037d7);_0x3c9a45[_0x1bb835('0x46')][_0x1bb835('0x1f')]&&(_0x42bdb9['where']=_[_0x1bb835('0x20')](_0x42bdb9[_0x1bb835('0x11')],{[Op['or']]:_[_0x1bb835('0x41')](_0x3037d7,function(_0x4978fc){const _0x2a982e=_0x1bb835;if(_0x4978fc[_0x2a982e('0x2a')]!==_0x2a982e('0x45')){const _0x37be8d={};return _0x37be8d[_0x4978fc[_0x2a982e('0x3a')]]={[Op['like']]:'%'+_0x3c9a45[_0x2a982e('0x46')][_0x2a982e('0x1f')]+'%'},_0x37be8d;}})}));_0x42bdb9=_[_0x1bb835('0x20')]({},_0x42bdb9,_0x3c9a45['options']);const _0x4cd6df={'where':_0x42bdb9[_0x1bb835('0x11')]};return db[_0x1bb835('0x35')]['count'](_0x4cd6df)['then'](function(_0x219cd5){const _0x24bebe=_0x1bb835;return _0x55cef4[_0x24bebe('0x6')]=_0x219cd5,_0x3c9a45[_0x24bebe('0x46')]['includeAll']&&(_0x42bdb9[_0x24bebe('0x3e')]=[{'all':!![]}]),db['SquareProject'][_0x24bebe('0x43')](_0x42bdb9);})[_0x1bb835('0x3c')](function(_0x1c03b8){const _0x370697=_0x1bb835;return _0x55cef4[_0x370697('0x30')]=_0x1c03b8,_0x55cef4;})['then'](respondWithFilteredResult(_0x5183fc,_0x42bdb9))[_0x1bb835('0x2')](handleError(_0x5183fc,null));},exports['show']=function(_0x1b1804,_0x99de0d){const _0x35c064=_0xe4247a;let _0x22c7c4={'raw':![],'where':{'id':_0x1b1804[_0x35c064('0x10')]['id']}};const _0x3fe9bd={};return _0x3fe9bd[_0x35c064('0x2f')]=_[_0x35c064('0xd')](db[_0x35c064('0x35')]['rawAttributes']),_0x3fe9bd[_0x35c064('0x46')]=_[_0x35c064('0xd')](_0x1b1804['query']),_0x3fe9bd[_0x35c064('0x42')]=_[_0x35c064('0x14')](_0x3fe9bd['model'],_0x3fe9bd[_0x35c064('0x46')]),_0x22c7c4[_0x35c064('0x1b')]=_[_0x35c064('0x14')](_0x3fe9bd['model'],qs[_0x35c064('0x27')](_0x1b1804[_0x35c064('0x46')]['fields'])),_0x22c7c4[_0x35c064('0x1b')]=_0x22c7c4[_0x35c064('0x1b')][_0x35c064('0x0')]?_0x22c7c4['attributes']:_0x3fe9bd['model'],_0x1b1804[_0x35c064('0x46')][_0x35c064('0x1c')]&&(_0x22c7c4['include']=[{'all':!![]}]),_0x22c7c4=_[_0x35c064('0x20')]({},_0x22c7c4,_0x1b1804['options']),db[_0x35c064('0x35')][_0x35c064('0x13')](_0x22c7c4)[_0x35c064('0x3c')](handleEntityNotFound(_0x99de0d,null))[_0x35c064('0x3c')](respondWithResult(_0x99de0d,null))[_0x35c064('0x2')](handleError(_0x99de0d,null));},exports['create']=function(_0x385b95,_0x42cee3){const _0x315609=_0xe4247a;return db[_0x315609('0x35')][_0x315609('0x21')](_0x385b95[_0x315609('0x39')],{})['then'](function(_0xb1b4cf){const _0x31333a=_0x315609,_0x50539c=_0x385b95[_0x31333a('0x15')][_0x31333a('0x34')]({'plain':!![]});if(!_0x50539c)throw new Error(_0x31333a('0x22'));if(_0x50539c['role']===_0x31333a('0x15')){const _0x35702d=_0xb1b4cf[_0x31333a('0x34')]({'plain':!![]}),_0x331492='SquareProjects';return db[_0x31333a('0x24')][_0x31333a('0x13')]({'where':{'name':_0x331492,'userProfileId':_0x50539c[_0x31333a('0x2e')]},'raw':!![]})['then'](function(_0x47f938){const _0x1c58ba=_0x31333a;return _0x47f938&&_0x47f938['autoAssociation']===0x0?db[_0x1c58ba('0x25')][_0x1c58ba('0x21')]({'name':_0x35702d[_0x1c58ba('0x3a')],'resourceId':_0x35702d['id'],'type':_0x47f938[_0x1c58ba('0x3a')],'sectionId':_0x47f938['id']},{})[_0x1c58ba('0x3c')](function(){return _0xb1b4cf;}):_0xb1b4cf;})[_0x31333a('0x2')](function(_0xd7ff47){const _0x38b7b4=_0x31333a;logger[_0x38b7b4('0x4')](_0x38b7b4('0xa'),_0xd7ff47);throw _0xd7ff47;});}return _0xb1b4cf;})[_0x315609('0x3c')](respondWithResult(_0x42cee3,0xc9))[_0x315609('0x2')](handleError(_0x42cee3,null));},exports[_0xe4247a('0x3f')]=function(_0x4c93e4,_0x165390){const _0x5b3a6c=_0xe4247a;return _0x4c93e4['body']['id']&&delete _0x4c93e4[_0x5b3a6c('0x39')]['id'],db[_0x5b3a6c('0x35')][_0x5b3a6c('0x13')]({'where':{'id':_0x4c93e4['params']['id']}})[_0x5b3a6c('0x3c')](handleEntityNotFound(_0x165390,null))[_0x5b3a6c('0x3c')](saveUpdates(_0x4c93e4[_0x5b3a6c('0x39')],null))[_0x5b3a6c('0x3c')](respondWithResult(_0x165390,null))['catch'](handleError(_0x165390,null));},exports[_0xe4247a('0x3')]=function(_0x2d4af5,_0x372c37){const _0x549d44=_0xe4247a;return db[_0x549d44('0x35')][_0x549d44('0x13')]({'where':{'id':_0x2d4af5[_0x549d44('0x10')]['id']}})[_0x549d44('0x3c')](handleEntityNotFound(_0x372c37,null))[_0x549d44('0x3c')](removeEntity(_0x372c37,null))[_0x549d44('0x2')](handleError(_0x372c37,null));},exports[_0xe4247a('0x33')]=function(_0x5b546b,_0x111cfe){const _0x5b4770=_0xe4247a;return db[_0x5b4770('0x35')]['findOne']({'where':{'id':_0x5b546b['params']['id']}})[_0x5b4770('0x3c')](function(_0x2e208e){const _0x8835b6=_0x5b4770;if(_0x2e208e)return _0x2e208e[_0x8835b6('0x33')](_0x5b546b[_0x8835b6('0x39')][_0x8835b6('0x2d')],{'through':_[_0x8835b6('0x8')](_0x5b546b[_0x8835b6('0x39')],['ids','id'])});})['then'](respondWithResult(_0x111cfe,null))['catch'](handleError(_0x111cfe,null));},exports[_0xe4247a('0x38')]=function(_0x2520d1,_0x1c18ff){const _0x86d69e=_0xe4247a;return db[_0x86d69e('0x35')][_0x86d69e('0x13')]({'where':{'id':_0x2520d1[_0x86d69e('0x10')]['id']}})['then'](handleEntityNotFound(_0x1c18ff,null))['then'](function(_0x279c52){const _0x396458=_0x86d69e;if(_0x279c52)return _0x279c52['removeUsers'](_0x2520d1[_0x396458('0x46')][_0x396458('0x2d')])[_0x396458('0x3c')](function(){const _0x461a47=_0x396458;if(_[_0x461a47('0xb')](_0x2520d1[_0x461a47('0x46')]['ids']))for(let _0x43f052=0x0;_0x43f052<_0x2520d1['query'][_0x461a47('0x2d')][_0x461a47('0x0')];_0x43f052+=0x1){socket[_0x461a47('0x1a')](_0x461a47('0xc'),{'UserId':Number(_0x2520d1[_0x461a47('0x46')][_0x461a47('0x2d')][_0x43f052]),'SquareProjectId':Number(_0x2520d1[_0x461a47('0x10')]['id'])});}else socket[_0x461a47('0x1a')](_0x461a47('0xc'),{'UserId':Number(_0x2520d1[_0x461a47('0x46')][_0x461a47('0x2d')]),'SquareProjectId':Number(_0x2520d1['params']['id'])});});})[_0x86d69e('0x3c')](respondWithStatusCode(_0x1c18ff,null))['catch'](handleError(_0x1c18ff,null));},exports['getUsers']=function(_0x7f3c27,_0xcaaf06){const _0x59dbdb=_0xe4247a;let _0x403ae3={};const _0x1de741={};let _0x3e2060,_0x1b6480;return db[_0x59dbdb('0x35')][_0x59dbdb('0x13')]({'where':{'id':_0x7f3c27[_0x59dbdb('0x10')]['id']}})[_0x59dbdb('0x3c')](handleEntityNotFound(_0xcaaf06,null))[_0x59dbdb('0x3c')](function(_0x2aa2e3){const _0x5ee72f=_0x59dbdb;if(_0x2aa2e3)return _0x3e2060=_0x2aa2e3,_0x1de741[_0x5ee72f('0x2f')]=_['keys'](db[_0x5ee72f('0x16')][_0x5ee72f('0x32')]),_0x1de741[_0x5ee72f('0x46')]=_[_0x5ee72f('0xd')](_0x7f3c27['query']),_0x1de741[_0x5ee72f('0x42')]=_[_0x5ee72f('0x14')](_0x1de741[_0x5ee72f('0x2f')],_0x1de741[_0x5ee72f('0x46')]),_0x403ae3[_0x5ee72f('0x1b')]=_[_0x5ee72f('0x14')](_0x1de741[_0x5ee72f('0x2f')],qs[_0x5ee72f('0x27')](_0x7f3c27['query'][_0x5ee72f('0x27')])),_0x403ae3[_0x5ee72f('0x1b')]=_0x403ae3['attributes'][_0x5ee72f('0x0')]?_0x403ae3[_0x5ee72f('0x1b')]:_0x1de741[_0x5ee72f('0x2f')],_0x403ae3['order']=qs[_0x5ee72f('0x44')](_0x7f3c27[_0x5ee72f('0x46')][_0x5ee72f('0x44')]),_0x403ae3[_0x5ee72f('0x11')]=qs[_0x5ee72f('0x42')](_[_0x5ee72f('0xf')](_0x7f3c27[_0x5ee72f('0x46')],_0x1de741['filters'])),_0x7f3c27['query'][_0x5ee72f('0x1f')]&&(_0x403ae3[_0x5ee72f('0x11')]=_['merge'](_0x403ae3[_0x5ee72f('0x11')],{[Op['or']]:_['map'](_0x403ae3[_0x5ee72f('0x1b')],function(_0x53fbd7){const _0x1c1251=_0x5ee72f,_0x251b9a={};return _0x251b9a[_0x53fbd7]={[Op[_0x1c1251('0x1d')]]:'%'+_0x7f3c27[_0x1c1251('0x46')][_0x1c1251('0x1f')]+'%'},_0x251b9a;})})),_0x403ae3=_[_0x5ee72f('0x20')]({},_0x403ae3,_0x7f3c27['options']),_0x3e2060['getUsers'](_0x403ae3);})['then'](function(_0x2b0ee6){const _0x43efc0=_0x59dbdb;if(_0x2b0ee6)return _0x1b6480=_0x2b0ee6['length'],typeof _0x7f3c27[_0x43efc0('0x46')][_0x43efc0('0x19')]===_0x43efc0('0x9')&&(_0x403ae3['limit']=qs[_0x43efc0('0x1e')](_0x7f3c27['query'][_0x43efc0('0x1e')]),_0x403ae3[_0x43efc0('0x17')]=qs[_0x43efc0('0x17')](_0x7f3c27[_0x43efc0('0x46')][_0x43efc0('0x17')])),_0x3e2060[_0x43efc0('0x29')](_0x403ae3);})[_0x59dbdb('0x3c')](function(_0x4d32ed){if(_0x4d32ed)return _0x4d32ed?{'count':_0x1b6480,'rows':_0x4d32ed}:null;})[_0x59dbdb('0x3c')](respondWithResult(_0xcaaf06,null))[_0x59dbdb('0x2')](handleError(_0xcaaf06,null));};
\ No newline at end of file