Built motion from commit (unavailable).|2.5.23
[motion2.git] / server / api / squareProject / squareProject.controller.js
index 88c1de5..90288a6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x815d=['offset','limit','set','apply','reject','save','update','then','get','SquareProjects','error','stack','name','send','map','SquareProject','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','findOne','getUsers','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','./squareProject.socket','register','sendStatus','end','status','json','count'];(function(_0x4fa916,_0x3ec36a){var _0x576439=function(_0x5692e0){while(--_0x5692e0){_0x4fa916['push'](_0x4fa916['shift']());}};_0x576439(++_0x3ec36a);}(_0x815d,0x15b));var _0xd815=function(_0x49b33e,_0xef5e0a){_0x49b33e=_0x49b33e-0x0;var _0x3128a2=_0x815d[_0x49b33e];return _0x3128a2;};'use strict';var pdf=require(_0xd815('0x0'));var emlformat=require(_0xd815('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd815('0x2'));var jsonpatch=require(_0xd815('0x3'));var rp=require('request-promise');var moment=require(_0xd815('0x4'));var BPromise=require(_0xd815('0x5'));var Mustache=require(_0xd815('0x6'));var util=require('util');var path=require(_0xd815('0x7'));var sox=require(_0xd815('0x8'));var csv=require(_0xd815('0x9'));var ejs=require(_0xd815('0xa'));var fs=require('fs');var _=require(_0xd815('0xb'));var squel=require(_0xd815('0xc'));var crypto=require(_0xd815('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd815('0x9'));var querystring=require(_0xd815('0xe'));var Papa=require(_0xd815('0xf'));var Redis=require(_0xd815('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd815('0x11'));var as=require(_0xd815('0x12'));var hardwareService=require(_0xd815('0x13'));var logger=require(_0xd815('0x14'))(_0xd815('0x15'));var utils=require(_0xd815('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd815('0x17'));var db=require('../../mysqldb')['db'];config[_0xd815('0x18')]=_['defaults'](config[_0xd815('0x18')],{'host':_0xd815('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd815('0x18')]));require(_0xd815('0x1a'))[_0xd815('0x1b')](socket);function respondWithStatusCode(_0x2db3e8,_0x5ef3ec){_0x5ef3ec=_0x5ef3ec||0xcc;return function(_0x23d002){if(_0x23d002){return _0x2db3e8[_0xd815('0x1c')](_0x5ef3ec);}return _0x2db3e8['status'](_0x5ef3ec)[_0xd815('0x1d')]();};}function respondWithResult(_0x4dd573,_0x229a8b){_0x229a8b=_0x229a8b||0xc8;return function(_0x3a85a2){if(_0x3a85a2){return _0x4dd573[_0xd815('0x1e')](_0x229a8b)[_0xd815('0x1f')](_0x3a85a2);}};}function respondWithFilteredResult(_0x53ac1e,_0x3dbb7e){return function(_0x112a7e){if(_0x112a7e){var _0x2da423=_0x112a7e[_0xd815('0x20')],_0x51887e=_0x3dbb7e[_0xd815('0x21')],_0x47c7ea=_0x3dbb7e[_0xd815('0x21')]+_0x3dbb7e[_0xd815('0x22')],_0x4f2e5d;if(_0x47c7ea>=_0x2da423){_0x47c7ea=_0x2da423;_0x4f2e5d=0xc8;}else{_0x4f2e5d=0xce;}_0x53ac1e['status'](_0x4f2e5d);return _0x53ac1e[_0xd815('0x23')]('Content-Range',_0x51887e+'-'+_0x47c7ea+'/'+_0x2da423)[_0xd815('0x1f')](_0x112a7e);}return null;};}function patchUpdates(_0x3f607c){return function(_0x32210a){try{jsonpatch[_0xd815('0x24')](_0x32210a,_0x3f607c,!![]);}catch(_0x3d680d){return BPromise[_0xd815('0x25')](_0x3d680d);}return _0x32210a[_0xd815('0x26')]();};}function saveUpdates(_0x249527,_0x37b786){return function(_0x412cbf){if(_0x412cbf){return _0x412cbf[_0xd815('0x27')](_0x249527)[_0xd815('0x28')](function(_0x4a1eda){return _0x4a1eda;});}return null;};}function removeEntity(_0x27b22f,_0x2f08ac){return function(_0x2ca859){if(_0x2ca859){return _0x2ca859['destroy']()['then'](function(){var _0x41a11a=_0x2ca859[_0xd815('0x29')]({'plain':!![]});var _0x2f4054=_0xd815('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x2f4054,'resourceId':_0x41a11a['id']}})[_0xd815('0x28')](function(){return _0x2ca859;});})[_0xd815('0x28')](function(){_0x27b22f[_0xd815('0x1e')](0xcc)[_0xd815('0x1d')]();});}};}function handleEntityNotFound(_0x1dd71f,_0x421e59){return function(_0xe6607a){if(!_0xe6607a){_0x1dd71f[_0xd815('0x1c')](0x194);}return _0xe6607a;};}function handleError(_0x23047f,_0x1948a2){_0x1948a2=_0x1948a2||0x1f4;return function(_0xa799bd){logger[_0xd815('0x2b')](_0xa799bd[_0xd815('0x2c')]);if(_0xa799bd[_0xd815('0x2d')]){delete _0xa799bd[_0xd815('0x2d')];}_0x23047f[_0xd815('0x1e')](_0x1948a2)[_0xd815('0x2e')](_0xa799bd);};}exports['index']=function(_0x3c6ca9,_0x3cc525){var _0x530a9a={},_0x406745={},_0x535557={'count':0x0,'rows':[]};var _0x17b682=_[_0xd815('0x2f')](db[_0xd815('0x30')][_0xd815('0x31')],function(_0x298681){return{'name':_0x298681['fieldName'],'type':_0x298681[_0xd815('0x32')][_0xd815('0x33')]};});_0x406745[_0xd815('0x34')]=_['map'](_0x17b682,_0xd815('0x2d'));_0x406745['query']=_[_0xd815('0x35')](_0x3c6ca9[_0xd815('0x36')]);_0x406745[_0xd815('0x37')]=_[_0xd815('0x38')](_0x406745['model'],_0x406745['query']);_0x530a9a[_0xd815('0x39')]=_[_0xd815('0x38')](_0x406745['model'],qs['fields'](_0x3c6ca9[_0xd815('0x36')][_0xd815('0x3a')]));_0x530a9a[_0xd815('0x39')]=_0x530a9a[_0xd815('0x39')][_0xd815('0x3b')]?_0x530a9a[_0xd815('0x39')]:_0x406745[_0xd815('0x34')];if(!_0x3c6ca9[_0xd815('0x36')][_0xd815('0x3c')](_0xd815('0x3d'))){_0x530a9a[_0xd815('0x22')]=qs[_0xd815('0x22')](_0x3c6ca9[_0xd815('0x36')]['limit']);_0x530a9a[_0xd815('0x21')]=qs[_0xd815('0x21')](_0x3c6ca9[_0xd815('0x36')][_0xd815('0x21')]);}_0x530a9a[_0xd815('0x3e')]=qs[_0xd815('0x3f')](_0x3c6ca9[_0xd815('0x36')][_0xd815('0x3f')]);_0x530a9a[_0xd815('0x40')]=qs[_0xd815('0x37')](_[_0xd815('0x41')](_0x3c6ca9[_0xd815('0x36')],_0x406745[_0xd815('0x37')]),_0x17b682);if(_0x3c6ca9[_0xd815('0x36')]['filter']){_0x530a9a[_0xd815('0x40')]=_[_0xd815('0x42')](_0x530a9a[_0xd815('0x40')],{'$or':_['map'](_0x17b682,function(_0x11bfb0){if(_0x11bfb0[_0xd815('0x32')]!==_0xd815('0x43')){var _0x2ab2db={};_0x2ab2db[_0x11bfb0[_0xd815('0x2d')]]={'$like':'%'+_0x3c6ca9['query'][_0xd815('0x44')]+'%'};return _0x2ab2db;}})});}_0x530a9a=_[_0xd815('0x42')]({},_0x530a9a,_0x3c6ca9[_0xd815('0x45')]);var _0x5cb213={'where':_0x530a9a[_0xd815('0x40')]};return db[_0xd815('0x30')][_0xd815('0x20')](_0x5cb213)[_0xd815('0x28')](function(_0x27e055){_0x535557[_0xd815('0x20')]=_0x27e055;if(_0x3c6ca9[_0xd815('0x36')][_0xd815('0x46')]){_0x530a9a[_0xd815('0x47')]=[{'all':!![]}];}return db['SquareProject'][_0xd815('0x48')](_0x530a9a);})['then'](function(_0x34a14f){_0x535557[_0xd815('0x49')]=_0x34a14f;return _0x535557;})['then'](respondWithFilteredResult(_0x3cc525,_0x530a9a))['catch'](handleError(_0x3cc525,null));};exports['show']=function(_0x18501c,_0x39cf56){var _0x40d004={'raw':![],'where':{'id':_0x18501c['params']['id']}},_0x32238a={};_0x32238a[_0xd815('0x34')]=_[_0xd815('0x35')](db[_0xd815('0x30')][_0xd815('0x31')]);_0x32238a['query']=_[_0xd815('0x35')](_0x18501c[_0xd815('0x36')]);_0x32238a[_0xd815('0x37')]=_[_0xd815('0x38')](_0x32238a[_0xd815('0x34')],_0x32238a[_0xd815('0x36')]);_0x40d004['attributes']=_[_0xd815('0x38')](_0x32238a[_0xd815('0x34')],qs[_0xd815('0x3a')](_0x18501c['query'][_0xd815('0x3a')]));_0x40d004[_0xd815('0x39')]=_0x40d004[_0xd815('0x39')][_0xd815('0x3b')]?_0x40d004[_0xd815('0x39')]:_0x32238a[_0xd815('0x34')];if(_0x18501c[_0xd815('0x36')][_0xd815('0x46')]){_0x40d004['include']=[{'all':!![]}];}_0x40d004=_[_0xd815('0x42')]({},_0x40d004,_0x18501c[_0xd815('0x45')]);return db[_0xd815('0x30')]['find'](_0x40d004)['then'](handleEntityNotFound(_0x39cf56,null))[_0xd815('0x28')](respondWithResult(_0x39cf56,null))[_0xd815('0x4a')](handleError(_0x39cf56,null));};exports[_0xd815('0x4b')]=function(_0x3e3fbc,_0x260053){return db['SquareProject'][_0xd815('0x4b')](_0x3e3fbc['body'],{})[_0xd815('0x28')](function(_0x28dd6d){var _0x2c5a8a=_0x3e3fbc[_0xd815('0x4c')][_0xd815('0x29')]({'plain':!![]});if(!_0x2c5a8a)throw new Error(_0xd815('0x4d'));if(_0x2c5a8a[_0xd815('0x4e')]==='user'){var _0x228c93=_0x28dd6d[_0xd815('0x29')]({'plain':!![]});var _0x1dc393=_0xd815('0x2a');return db[_0xd815('0x4f')][_0xd815('0x50')]({'where':{'name':_0x1dc393,'userProfileId':_0x2c5a8a['userProfileId']},'raw':!![]})[_0xd815('0x28')](function(_0x3c0807){if(_0x3c0807&&_0x3c0807[_0xd815('0x51')]===0x0){return db[_0xd815('0x52')][_0xd815('0x4b')]({'name':_0x228c93['name'],'resourceId':_0x228c93['id'],'type':_0x3c0807[_0xd815('0x2d')],'sectionId':_0x3c0807['id']},{})[_0xd815('0x28')](function(){return _0x28dd6d;});}else{return _0x28dd6d;}})['catch'](function(_0x31145e){logger[_0xd815('0x2b')](_0xd815('0x53'),_0x31145e);throw _0x31145e;});}return _0x28dd6d;})[_0xd815('0x28')](respondWithResult(_0x260053,0xc9))['catch'](handleError(_0x260053,null));};exports[_0xd815('0x27')]=function(_0x509db4,_0x3c438c){if(_0x509db4[_0xd815('0x54')]['id']){delete _0x509db4[_0xd815('0x54')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x509db4[_0xd815('0x55')]['id']}})[_0xd815('0x28')](handleEntityNotFound(_0x3c438c,null))[_0xd815('0x28')](saveUpdates(_0x509db4[_0xd815('0x54')],null))[_0xd815('0x28')](respondWithResult(_0x3c438c,null))['catch'](handleError(_0x3c438c,null));};exports[_0xd815('0x56')]=function(_0x160762,_0x3dbef6){return db['SquareProject']['find']({'where':{'id':_0x160762[_0xd815('0x55')]['id']}})['then'](handleEntityNotFound(_0x3dbef6,null))[_0xd815('0x28')](removeEntity(_0x3dbef6,null))['catch'](handleError(_0x3dbef6,null));};exports[_0xd815('0x57')]=function(_0x595124,_0x57964e,_0x5c0259){return db[_0xd815('0x30')][_0xd815('0x50')]({'where':{'id':_0x595124[_0xd815('0x55')]['id']}})['then'](handleEntityNotFound(_0x57964e,null))[_0xd815('0x28')](function(_0x347aa8){if(_0x347aa8){return _0x347aa8[_0xd815('0x57')](_0x595124[_0xd815('0x54')][_0xd815('0x58')],_[_0xd815('0x59')](_0x595124[_0xd815('0x54')],[_0xd815('0x58'),'id'])||{});}})['then'](respondWithResult(_0x57964e,null))['catch'](handleError(_0x57964e,null));};exports[_0xd815('0x5a')]=function(_0x489aa2,_0x990b70,_0x5e7f44){return db['SquareProject'][_0xd815('0x50')]({'where':{'id':_0x489aa2['params']['id']}})[_0xd815('0x28')](handleEntityNotFound(_0x990b70,null))[_0xd815('0x28')](function(_0x47c643){if(_0x47c643){return _0x47c643[_0xd815('0x5a')](_0x489aa2[_0xd815('0x36')][_0xd815('0x58')])[_0xd815('0x28')](function(){if(_[_0xd815('0x5b')](_0x489aa2[_0xd815('0x36')][_0xd815('0x58')])){for(var _0x3dd9ac=0x0;_0x3dd9ac<_0x489aa2[_0xd815('0x36')]['ids'][_0xd815('0x3b')];_0x3dd9ac+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x489aa2['query'][_0xd815('0x58')][_0x3dd9ac]),'SquareProjectId':Number(_0x489aa2[_0xd815('0x55')]['id'])});}}else{socket['emit'](_0xd815('0x5c'),{'UserId':Number(_0x489aa2[_0xd815('0x36')][_0xd815('0x58')]),'SquareProjectId':Number(_0x489aa2[_0xd815('0x55')]['id'])});}});}})[_0xd815('0x28')](respondWithStatusCode(_0x990b70,null))['catch'](handleError(_0x990b70,null));};exports['getUsers']=function(_0x5812f4,_0xe39a02,_0x528812){var _0xb735b4={};var _0x3365e2={};var _0x1105b8;var _0x124f87;return db['SquareProject'][_0xd815('0x5d')]({'where':{'id':_0x5812f4[_0xd815('0x55')]['id']}})[_0xd815('0x28')](handleEntityNotFound(_0xe39a02,null))[_0xd815('0x28')](function(_0x22ff48){if(_0x22ff48){_0x1105b8=_0x22ff48;_0x3365e2[_0xd815('0x34')]=_[_0xd815('0x35')](db['User'][_0xd815('0x31')]);_0x3365e2[_0xd815('0x36')]=_['keys'](_0x5812f4['query']);_0x3365e2[_0xd815('0x37')]=_[_0xd815('0x38')](_0x3365e2[_0xd815('0x34')],_0x3365e2['query']);_0xb735b4[_0xd815('0x39')]=_[_0xd815('0x38')](_0x3365e2[_0xd815('0x34')],qs[_0xd815('0x3a')](_0x5812f4['query'][_0xd815('0x3a')]));_0xb735b4[_0xd815('0x39')]=_0xb735b4[_0xd815('0x39')][_0xd815('0x3b')]?_0xb735b4[_0xd815('0x39')]:_0x3365e2[_0xd815('0x34')];_0xb735b4[_0xd815('0x3e')]=qs[_0xd815('0x3f')](_0x5812f4['query'][_0xd815('0x3f')]);_0xb735b4[_0xd815('0x40')]=qs[_0xd815('0x37')](_[_0xd815('0x41')](_0x5812f4[_0xd815('0x36')],_0x3365e2['filters']));if(_0x5812f4['query'][_0xd815('0x44')]){_0xb735b4[_0xd815('0x40')]=_['merge'](_0xb735b4[_0xd815('0x40')],{'$or':_[_0xd815('0x2f')](_0xb735b4[_0xd815('0x39')],function(_0x2054f9){var _0x17d925={};_0x17d925[_0x2054f9]={'$like':'%'+_0x5812f4[_0xd815('0x36')][_0xd815('0x44')]+'%'};return _0x17d925;})});}_0xb735b4=_[_0xd815('0x42')]({},_0xb735b4,_0x5812f4[_0xd815('0x45')]);return _0x1105b8['getUsers'](_0xb735b4);}})[_0xd815('0x28')](function(_0x3a9cb7){if(_0x3a9cb7){_0x124f87=_0x3a9cb7[_0xd815('0x3b')];if(!_0x5812f4[_0xd815('0x36')][_0xd815('0x3c')](_0xd815('0x3d'))){_0xb735b4['limit']=qs['limit'](_0x5812f4['query'][_0xd815('0x22')]);_0xb735b4[_0xd815('0x21')]=qs[_0xd815('0x21')](_0x5812f4[_0xd815('0x36')][_0xd815('0x21')]);}return _0x1105b8[_0xd815('0x5e')](_0xb735b4);}})[_0xd815('0x28')](function(_0x286980){if(_0x286980){return _0x286980?{'count':_0x124f87,'rows':_0x286980}:null;}})[_0xd815('0x28')](respondWithResult(_0xe39a02,null))[_0xd815('0x4a')](handleError(_0xe39a02,null));};
\ No newline at end of file
+var _0x66c9=['Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','omit','removeUsers','ids','isArray','emit','userSquareProject:remove','getUsers','findOne','User','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./squareProject.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','SquareProjects','error','name','index','map','SquareProject','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','rows','catch','show','params','rawAttributes','length','includeAll','create','body','user','get'];(function(_0x6fdd37,_0x145e75){var _0x1fc956=function(_0x282b0a){while(--_0x282b0a){_0x6fdd37['push'](_0x6fdd37['shift']());}};_0x1fc956(++_0x145e75);}(_0x66c9,0xd1));var _0x966c=function(_0x486702,_0x478de4){_0x486702=_0x486702-0x0;var _0x572974=_0x66c9[_0x486702];return _0x572974;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x966c('0x0'));var rimraf=require(_0x966c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x966c('0x2'));var rp=require(_0x966c('0x3'));var moment=require(_0x966c('0x4'));var BPromise=require(_0x966c('0x5'));var Mustache=require(_0x966c('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x966c('0x7'));var ejs=require(_0x966c('0x8'));var fs=require('fs');var _=require(_0x966c('0x9'));var squel=require(_0x966c('0xa'));var crypto=require(_0x966c('0xb'));var jsforce=require(_0x966c('0xc'));var deskjs=require(_0x966c('0xd'));var toCsv=require(_0x966c('0x7'));var querystring=require(_0x966c('0xe'));var Papa=require(_0x966c('0xf'));var Redis=require(_0x966c('0x10'));var authService=require(_0x966c('0x11'));var qs=require(_0x966c('0x12'));var as=require(_0x966c('0x13'));var hardwareService=require(_0x966c('0x14'));var logger=require(_0x966c('0x15'))(_0x966c('0x16'));var utils=require(_0x966c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x966c('0x18'));var db=require('../../mysqldb')['db'];config[_0x966c('0x19')]=_[_0x966c('0x1a')](config[_0x966c('0x19')],{'host':_0x966c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x966c('0x1c'))[_0x966c('0x1d')](socket);function respondWithStatusCode(_0x8b7f7c,_0x438c2f){_0x438c2f=_0x438c2f||0xcc;return function(_0x302960){if(_0x302960){return _0x8b7f7c['sendStatus'](_0x438c2f);}return _0x8b7f7c[_0x966c('0x1e')](_0x438c2f)[_0x966c('0x1f')]();};}function respondWithResult(_0x545446,_0x298a1d){_0x298a1d=_0x298a1d||0xc8;return function(_0x332941){if(_0x332941){return _0x545446[_0x966c('0x1e')](_0x298a1d)[_0x966c('0x20')](_0x332941);}};}function respondWithFilteredResult(_0xdff34,_0xa1f96d){return function(_0xee4778){if(_0xee4778){var _0x47deaa=_0xee4778[_0x966c('0x21')],_0x2c2f8a=_0xa1f96d[_0x966c('0x22')],_0x250ba9=_0xa1f96d[_0x966c('0x22')]+_0xa1f96d[_0x966c('0x23')],_0x515ff9;if(_0x250ba9>=_0x47deaa){_0x250ba9=_0x47deaa;_0x515ff9=0xc8;}else{_0x515ff9=0xce;}_0xdff34[_0x966c('0x1e')](_0x515ff9);return _0xdff34[_0x966c('0x24')](_0x966c('0x25'),_0x2c2f8a+'-'+_0x250ba9+'/'+_0x47deaa)[_0x966c('0x20')](_0xee4778);}return null;};}function patchUpdates(_0x20b76b){return function(_0xe0ba18){try{jsonpatch[_0x966c('0x26')](_0xe0ba18,_0x20b76b,!![]);}catch(_0x226df7){return BPromise[_0x966c('0x27')](_0x226df7);}return _0xe0ba18[_0x966c('0x28')]();};}function saveUpdates(_0x1e9c12,_0x2fb460){return function(_0x2b78cd){if(_0x2b78cd){return _0x2b78cd['update'](_0x1e9c12)[_0x966c('0x29')](function(_0x511136){return _0x511136;});}return null;};}function removeEntity(_0x47fc05,_0x42a02b){return function(_0x1d1882){if(_0x1d1882){return _0x1d1882[_0x966c('0x2a')]()[_0x966c('0x29')](function(){var _0x229816=_0x1d1882['get']({'plain':!![]});var _0x1184b5=_0x966c('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x1184b5,'resourceId':_0x229816['id']}})[_0x966c('0x29')](function(){return _0x1d1882;});})[_0x966c('0x29')](function(){_0x47fc05['status'](0xcc)[_0x966c('0x1f')]();});}};}function handleEntityNotFound(_0x376c6f,_0x559243){return function(_0x2c4e55){if(!_0x2c4e55){_0x376c6f['sendStatus'](0x194);}return _0x2c4e55;};}function handleError(_0x2e7663,_0x584e1a){_0x584e1a=_0x584e1a||0x1f4;return function(_0x3414bf){logger[_0x966c('0x2c')](_0x3414bf['stack']);if(_0x3414bf[_0x966c('0x2d')]){delete _0x3414bf[_0x966c('0x2d')];}_0x2e7663[_0x966c('0x1e')](_0x584e1a)['send'](_0x3414bf);};}exports[_0x966c('0x2e')]=function(_0x40de12,_0x14935b){var _0x5b6d01={},_0x4171c7={},_0x930a67={'count':0x0,'rows':[]};var _0x2b8ef7=_[_0x966c('0x2f')](db[_0x966c('0x30')]['rawAttributes'],function(_0x374750){return{'name':_0x374750['fieldName'],'type':_0x374750['type'][_0x966c('0x31')]};});_0x4171c7['model']=_['map'](_0x2b8ef7,_0x966c('0x2d'));_0x4171c7[_0x966c('0x32')]=_[_0x966c('0x33')](_0x40de12[_0x966c('0x32')]);_0x4171c7[_0x966c('0x34')]=_[_0x966c('0x35')](_0x4171c7['model'],_0x4171c7['query']);_0x5b6d01[_0x966c('0x36')]=_[_0x966c('0x35')](_0x4171c7[_0x966c('0x37')],qs[_0x966c('0x38')](_0x40de12['query']['fields']));_0x5b6d01[_0x966c('0x36')]=_0x5b6d01[_0x966c('0x36')]['length']?_0x5b6d01[_0x966c('0x36')]:_0x4171c7[_0x966c('0x37')];if(!_0x40de12[_0x966c('0x32')][_0x966c('0x39')](_0x966c('0x3a'))){_0x5b6d01[_0x966c('0x23')]=qs[_0x966c('0x23')](_0x40de12[_0x966c('0x32')][_0x966c('0x23')]);_0x5b6d01[_0x966c('0x22')]=qs['offset'](_0x40de12['query'][_0x966c('0x22')]);}_0x5b6d01[_0x966c('0x3b')]=qs[_0x966c('0x3c')](_0x40de12[_0x966c('0x32')][_0x966c('0x3c')]);_0x5b6d01[_0x966c('0x3d')]=qs[_0x966c('0x34')](_[_0x966c('0x3e')](_0x40de12[_0x966c('0x32')],_0x4171c7[_0x966c('0x34')]),_0x2b8ef7);if(_0x40de12[_0x966c('0x32')][_0x966c('0x3f')]){_0x5b6d01[_0x966c('0x3d')]=_[_0x966c('0x40')](_0x5b6d01['where'],{'$or':_[_0x966c('0x2f')](_0x2b8ef7,function(_0x2af8af){if(_0x2af8af[_0x966c('0x41')]!=='VIRTUAL'){var _0x3ee92={};_0x3ee92[_0x2af8af[_0x966c('0x2d')]]={'$like':'%'+_0x40de12[_0x966c('0x32')][_0x966c('0x3f')]+'%'};return _0x3ee92;}})});}_0x5b6d01=_[_0x966c('0x40')]({},_0x5b6d01,_0x40de12[_0x966c('0x42')]);var _0x20115b={'where':_0x5b6d01[_0x966c('0x3d')]};return db[_0x966c('0x30')][_0x966c('0x21')](_0x20115b)[_0x966c('0x29')](function(_0x43e6e5){_0x930a67[_0x966c('0x21')]=_0x43e6e5;if(_0x40de12[_0x966c('0x32')]['includeAll']){_0x5b6d01[_0x966c('0x43')]=[{'all':!![]}];}return db[_0x966c('0x30')]['findAll'](_0x5b6d01);})[_0x966c('0x29')](function(_0x55257d){_0x930a67[_0x966c('0x44')]=_0x55257d;return _0x930a67;})[_0x966c('0x29')](respondWithFilteredResult(_0x14935b,_0x5b6d01))[_0x966c('0x45')](handleError(_0x14935b,null));};exports[_0x966c('0x46')]=function(_0x2b7e05,_0x364749){var _0x159059={'raw':![],'where':{'id':_0x2b7e05[_0x966c('0x47')]['id']}},_0x3bc5bb={};_0x3bc5bb[_0x966c('0x37')]=_['keys'](db['SquareProject'][_0x966c('0x48')]);_0x3bc5bb[_0x966c('0x32')]=_[_0x966c('0x33')](_0x2b7e05[_0x966c('0x32')]);_0x3bc5bb[_0x966c('0x34')]=_[_0x966c('0x35')](_0x3bc5bb[_0x966c('0x37')],_0x3bc5bb['query']);_0x159059[_0x966c('0x36')]=_['intersection'](_0x3bc5bb[_0x966c('0x37')],qs['fields'](_0x2b7e05['query'][_0x966c('0x38')]));_0x159059['attributes']=_0x159059['attributes'][_0x966c('0x49')]?_0x159059[_0x966c('0x36')]:_0x3bc5bb['model'];if(_0x2b7e05[_0x966c('0x32')][_0x966c('0x4a')]){_0x159059[_0x966c('0x43')]=[{'all':!![]}];}_0x159059=_[_0x966c('0x40')]({},_0x159059,_0x2b7e05[_0x966c('0x42')]);return db['SquareProject']['find'](_0x159059)[_0x966c('0x29')](handleEntityNotFound(_0x364749,null))[_0x966c('0x29')](respondWithResult(_0x364749,null))[_0x966c('0x45')](handleError(_0x364749,null));};exports[_0x966c('0x4b')]=function(_0x27a8a9,_0x515d07){return db[_0x966c('0x30')][_0x966c('0x4b')](_0x27a8a9[_0x966c('0x4c')],{})['then'](function(_0xc70d3f){var _0x416608=_0x27a8a9[_0x966c('0x4d')][_0x966c('0x4e')]({'plain':!![]});if(!_0x416608)throw new Error(_0x966c('0x4f'));if(_0x416608['role']==='user'){var _0xa06fa4=_0xc70d3f[_0x966c('0x4e')]({'plain':!![]});var _0x50a724=_0x966c('0x2b');return db['UserProfileSection'][_0x966c('0x50')]({'where':{'name':_0x50a724,'userProfileId':_0x416608[_0x966c('0x51')]},'raw':!![]})['then'](function(_0x4eec9c){if(_0x4eec9c&&_0x4eec9c[_0x966c('0x52')]===0x0){return db[_0x966c('0x53')]['create']({'name':_0xa06fa4[_0x966c('0x2d')],'resourceId':_0xa06fa4['id'],'type':_0x4eec9c[_0x966c('0x2d')],'sectionId':_0x4eec9c['id']},{})[_0x966c('0x29')](function(){return _0xc70d3f;});}else{return _0xc70d3f;}})['catch'](function(_0x2885cf){logger[_0x966c('0x2c')](_0x966c('0x54'),_0x2885cf);throw _0x2885cf;});}return _0xc70d3f;})[_0x966c('0x29')](respondWithResult(_0x515d07,0xc9))['catch'](handleError(_0x515d07,null));};exports[_0x966c('0x55')]=function(_0x2a8643,_0x381e46){if(_0x2a8643[_0x966c('0x4c')]['id']){delete _0x2a8643[_0x966c('0x4c')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x2a8643[_0x966c('0x47')]['id']}})[_0x966c('0x29')](handleEntityNotFound(_0x381e46,null))[_0x966c('0x29')](saveUpdates(_0x2a8643['body'],null))[_0x966c('0x29')](respondWithResult(_0x381e46,null))[_0x966c('0x45')](handleError(_0x381e46,null));};exports[_0x966c('0x2a')]=function(_0x1a1bcf,_0x1e2c2a){return db[_0x966c('0x30')][_0x966c('0x50')]({'where':{'id':_0x1a1bcf['params']['id']}})[_0x966c('0x29')](handleEntityNotFound(_0x1e2c2a,null))[_0x966c('0x29')](removeEntity(_0x1e2c2a,null))[_0x966c('0x45')](handleError(_0x1e2c2a,null));};exports[_0x966c('0x56')]=function(_0x2070d5,_0x719bdf,_0x4a62eb){return db[_0x966c('0x30')]['find']({'where':{'id':_0x2070d5[_0x966c('0x47')]['id']}})[_0x966c('0x29')](handleEntityNotFound(_0x719bdf,null))[_0x966c('0x29')](function(_0x3202ef){if(_0x3202ef){return _0x3202ef['addUsers'](_0x2070d5[_0x966c('0x4c')]['ids'],_[_0x966c('0x57')](_0x2070d5[_0x966c('0x4c')],['ids','id'])||{});}})[_0x966c('0x29')](respondWithResult(_0x719bdf,null))[_0x966c('0x45')](handleError(_0x719bdf,null));};exports[_0x966c('0x58')]=function(_0x3033fe,_0xfce63a,_0x4e8650){return db[_0x966c('0x30')][_0x966c('0x50')]({'where':{'id':_0x3033fe[_0x966c('0x47')]['id']}})[_0x966c('0x29')](handleEntityNotFound(_0xfce63a,null))[_0x966c('0x29')](function(_0x1ea4ef){if(_0x1ea4ef){return _0x1ea4ef[_0x966c('0x58')](_0x3033fe[_0x966c('0x32')][_0x966c('0x59')])[_0x966c('0x29')](function(){if(_[_0x966c('0x5a')](_0x3033fe[_0x966c('0x32')]['ids'])){for(var _0x35e818=0x0;_0x35e818<_0x3033fe[_0x966c('0x32')][_0x966c('0x59')][_0x966c('0x49')];_0x35e818+=0x1){socket[_0x966c('0x5b')]('userSquareProject:remove',{'UserId':Number(_0x3033fe[_0x966c('0x32')][_0x966c('0x59')][_0x35e818]),'SquareProjectId':Number(_0x3033fe[_0x966c('0x47')]['id'])});}}else{socket[_0x966c('0x5b')](_0x966c('0x5c'),{'UserId':Number(_0x3033fe[_0x966c('0x32')]['ids']),'SquareProjectId':Number(_0x3033fe[_0x966c('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0xfce63a,null))[_0x966c('0x45')](handleError(_0xfce63a,null));};exports[_0x966c('0x5d')]=function(_0x10d4a,_0xe7dec1,_0x488117){var _0x361354={};var _0x1acc2={};var _0x302eb0;var _0x1ea64b;return db['SquareProject'][_0x966c('0x5e')]({'where':{'id':_0x10d4a[_0x966c('0x47')]['id']}})[_0x966c('0x29')](handleEntityNotFound(_0xe7dec1,null))['then'](function(_0x2d0bbd){if(_0x2d0bbd){_0x302eb0=_0x2d0bbd;_0x1acc2[_0x966c('0x37')]=_[_0x966c('0x33')](db[_0x966c('0x5f')][_0x966c('0x48')]);_0x1acc2[_0x966c('0x32')]=_['keys'](_0x10d4a[_0x966c('0x32')]);_0x1acc2[_0x966c('0x34')]=_[_0x966c('0x35')](_0x1acc2['model'],_0x1acc2[_0x966c('0x32')]);_0x361354[_0x966c('0x36')]=_[_0x966c('0x35')](_0x1acc2[_0x966c('0x37')],qs[_0x966c('0x38')](_0x10d4a[_0x966c('0x32')][_0x966c('0x38')]));_0x361354[_0x966c('0x36')]=_0x361354[_0x966c('0x36')][_0x966c('0x49')]?_0x361354['attributes']:_0x1acc2[_0x966c('0x37')];_0x361354[_0x966c('0x3b')]=qs[_0x966c('0x3c')](_0x10d4a[_0x966c('0x32')]['sort']);_0x361354[_0x966c('0x3d')]=qs[_0x966c('0x34')](_[_0x966c('0x3e')](_0x10d4a['query'],_0x1acc2['filters']));if(_0x10d4a[_0x966c('0x32')][_0x966c('0x3f')]){_0x361354[_0x966c('0x3d')]=_[_0x966c('0x40')](_0x361354['where'],{'$or':_[_0x966c('0x2f')](_0x361354[_0x966c('0x36')],function(_0x3673c7){var _0x53834={};_0x53834[_0x3673c7]={'$like':'%'+_0x10d4a[_0x966c('0x32')][_0x966c('0x3f')]+'%'};return _0x53834;})});}_0x361354=_[_0x966c('0x40')]({},_0x361354,_0x10d4a[_0x966c('0x42')]);return _0x302eb0[_0x966c('0x5d')](_0x361354);}})['then'](function(_0x351237){if(_0x351237){_0x1ea64b=_0x351237[_0x966c('0x49')];if(!_0x10d4a['query'][_0x966c('0x39')]('nolimit')){_0x361354[_0x966c('0x23')]=qs[_0x966c('0x23')](_0x10d4a[_0x966c('0x32')]['limit']);_0x361354[_0x966c('0x22')]=qs[_0x966c('0x22')](_0x10d4a[_0x966c('0x32')][_0x966c('0x22')]);}return _0x302eb0[_0x966c('0x5d')](_0x361354);}})['then'](function(_0x4f4419){if(_0x4f4419){return _0x4f4419?{'count':_0x1ea64b,'rows':_0x4f4419}:null;}})[_0x966c('0x29')](respondWithResult(_0xe7dec1,null))[_0x966c('0x45')](handleError(_0xe7dec1,null));};
\ No newline at end of file