Built motion from commit (unavailable).|2.5.13
[motion2.git] / server / api / userProfileSection / userProfileSection.controller.js
index 972ed97..3b2f94a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x142b=['query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','send','index','UserProfileSection','rawAttributes','fieldName','type','key','map','name'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x142b,0x1bb));var _0xb142=function(_0x417600,_0x2439fe){_0x417600=_0x417600-0x0;var _0x1b9bb3=_0x142b[_0x417600];return _0x1b9bb3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb142('0x0'));var rp=require(_0xb142('0x1'));var moment=require(_0xb142('0x2'));var BPromise=require(_0xb142('0x3'));var Mustache=require(_0xb142('0x4'));var util=require('util');var path=require(_0xb142('0x5'));var sox=require(_0xb142('0x6'));var csv=require(_0xb142('0x7'));var ejs=require(_0xb142('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb142('0x9'));var jsforce=require(_0xb142('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb142('0x7'));var querystring=require(_0xb142('0xb'));var Papa=require(_0xb142('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb142('0xd'));var hardwareService=require(_0xb142('0xe'));var logger=require(_0xb142('0xf'))('api');var utils=require(_0xb142('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f2df6,_0x3f67ea){_0x3f67ea=_0x3f67ea||0xcc;return function(_0x134291){if(_0x134291){return _0x5f2df6['sendStatus'](_0x3f67ea);}return _0x5f2df6[_0xb142('0x11')](_0x3f67ea)[_0xb142('0x12')]();};}function respondWithResult(_0x3ba5d3,_0x4b143a){_0x4b143a=_0x4b143a||0xc8;return function(_0x223414){if(_0x223414){return _0x3ba5d3[_0xb142('0x11')](_0x4b143a)[_0xb142('0x13')](_0x223414);}};}function respondWithFilteredResult(_0x53673a,_0xe088e3){return function(_0x58fa25){if(_0x58fa25){var _0x202311=_0x58fa25[_0xb142('0x14')],_0x4c8539=_0xe088e3[_0xb142('0x15')],_0x49984a=_0xe088e3[_0xb142('0x15')]+_0xe088e3['limit'],_0x579b83;if(_0x49984a>=_0x202311){_0x49984a=_0x202311;_0x579b83=0xc8;}else{_0x579b83=0xce;}_0x53673a[_0xb142('0x11')](_0x579b83);return _0x53673a[_0xb142('0x16')](_0xb142('0x17'),_0x4c8539+'-'+_0x49984a+'/'+_0x202311)[_0xb142('0x13')](_0x58fa25);}return null;};}function patchUpdates(_0x46c986){return function(_0xf47f7b){try{jsonpatch[_0xb142('0x18')](_0xf47f7b,_0x46c986,!![]);}catch(_0x159210){return BPromise[_0xb142('0x19')](_0x159210);}return _0xf47f7b['save']();};}function saveUpdates(_0x38b982,_0x45339b){return function(_0x2e3d3f){if(_0x2e3d3f){return _0x2e3d3f[_0xb142('0x1a')](_0x38b982)['then'](function(_0x5d796f){return _0x5d796f;});}return null;};}function removeEntity(_0x49adc7,_0x1abee0){return function(_0x4c1bd1){if(_0x4c1bd1){return _0x4c1bd1[_0xb142('0x1b')]()[_0xb142('0x1c')](function(){_0x49adc7[_0xb142('0x11')](0xcc)[_0xb142('0x12')]();});}};}function handleEntityNotFound(_0x20379f,_0x5d1719){return function(_0xf7c23d){if(!_0xf7c23d){_0x20379f[_0xb142('0x1d')](0x194);}return _0xf7c23d;};}function handleError(_0x49521a,_0x153191){_0x153191=_0x153191||0x1f4;return function(_0x3c13f8){logger[_0xb142('0x1e')](_0x3c13f8['stack']);if(_0x3c13f8['name']){delete _0x3c13f8['name'];}_0x49521a[_0xb142('0x11')](_0x153191)[_0xb142('0x1f')](_0x3c13f8);};}exports[_0xb142('0x20')]=function(_0x436d13,_0x1a6827){var _0x10aafd={},_0x574602={},_0x7b674d={'count':0x0,'rows':[]};var _0x39dd28=_['map'](db[_0xb142('0x21')][_0xb142('0x22')],function(_0x5dad4f){return{'name':_0x5dad4f[_0xb142('0x23')],'type':_0x5dad4f[_0xb142('0x24')][_0xb142('0x25')]};});_0x574602['model']=_[_0xb142('0x26')](_0x39dd28,_0xb142('0x27'));_0x574602[_0xb142('0x28')]=_[_0xb142('0x29')](_0x436d13[_0xb142('0x28')]);_0x574602[_0xb142('0x2a')]=_[_0xb142('0x2b')](_0x574602[_0xb142('0x2c')],_0x574602['query']);_0x10aafd[_0xb142('0x2d')]=_[_0xb142('0x2b')](_0x574602[_0xb142('0x2c')],qs[_0xb142('0x2e')](_0x436d13['query']['fields']));_0x10aafd['attributes']=_0x10aafd[_0xb142('0x2d')][_0xb142('0x2f')]?_0x10aafd['attributes']:_0x574602[_0xb142('0x2c')];if(!_0x436d13[_0xb142('0x28')]['hasOwnProperty'](_0xb142('0x30'))){_0x10aafd[_0xb142('0x31')]=qs['limit'](_0x436d13[_0xb142('0x28')][_0xb142('0x31')]);_0x10aafd['offset']=qs[_0xb142('0x15')](_0x436d13['query'][_0xb142('0x15')]);}_0x10aafd[_0xb142('0x32')]=qs[_0xb142('0x33')](_0x436d13['query']['sort']);_0x10aafd['where']=qs[_0xb142('0x2a')](_[_0xb142('0x34')](_0x436d13[_0xb142('0x28')],_0x574602[_0xb142('0x2a')]),_0x39dd28);if(_0x436d13[_0xb142('0x28')][_0xb142('0x35')]){_0x10aafd[_0xb142('0x36')]=_[_0xb142('0x37')](_0x10aafd['where'],{'$or':_[_0xb142('0x26')](_0x39dd28,function(_0x340a42){if(_0x340a42[_0xb142('0x24')]!==_0xb142('0x38')){var _0x99af70={};_0x99af70[_0x340a42[_0xb142('0x27')]]={'$like':'%'+_0x436d13[_0xb142('0x28')][_0xb142('0x35')]+'%'};return _0x99af70;}})});}_0x10aafd=_[_0xb142('0x37')]({},_0x10aafd,_0x436d13['options']);var _0x269e5d={'where':_0x10aafd[_0xb142('0x36')]};return db[_0xb142('0x21')][_0xb142('0x14')](_0x269e5d)['then'](function(_0x291489){_0x7b674d[_0xb142('0x14')]=_0x291489;if(_0x436d13['query'][_0xb142('0x39')]){_0x10aafd[_0xb142('0x3a')]=[{'all':!![]}];}return db['UserProfileSection'][_0xb142('0x3b')](_0x10aafd);})['then'](function(_0x5dbdda){_0x7b674d[_0xb142('0x3c')]=_0x5dbdda;return _0x7b674d;})[_0xb142('0x1c')](respondWithFilteredResult(_0x1a6827,_0x10aafd))['catch'](handleError(_0x1a6827,null));};exports[_0xb142('0x3d')]=function(_0x55d9d4,_0x429ddc){var _0x39821d={'raw':![],'where':{'id':_0x55d9d4[_0xb142('0x3e')]['id']}},_0xe09e20={};_0xe09e20[_0xb142('0x2c')]=_[_0xb142('0x29')](db['UserProfileSection'][_0xb142('0x22')]);_0xe09e20[_0xb142('0x28')]=_[_0xb142('0x29')](_0x55d9d4[_0xb142('0x28')]);_0xe09e20[_0xb142('0x2a')]=_[_0xb142('0x2b')](_0xe09e20[_0xb142('0x2c')],_0xe09e20[_0xb142('0x28')]);_0x39821d[_0xb142('0x2d')]=_[_0xb142('0x2b')](_0xe09e20[_0xb142('0x2c')],qs[_0xb142('0x2e')](_0x55d9d4[_0xb142('0x28')][_0xb142('0x2e')]));_0x39821d['attributes']=_0x39821d[_0xb142('0x2d')]['length']?_0x39821d[_0xb142('0x2d')]:_0xe09e20[_0xb142('0x2c')];if(_0x55d9d4[_0xb142('0x28')][_0xb142('0x39')]){_0x39821d[_0xb142('0x3a')]=[{'all':!![]}];}_0x39821d=_['merge']({},_0x39821d,_0x55d9d4[_0xb142('0x3f')]);return db['UserProfileSection'][_0xb142('0x40')](_0x39821d)[_0xb142('0x1c')](handleEntityNotFound(_0x429ddc,null))[_0xb142('0x1c')](respondWithResult(_0x429ddc,null))[_0xb142('0x41')](handleError(_0x429ddc,null));};exports[_0xb142('0x42')]=function(_0x905606,_0x218b45){return db[_0xb142('0x21')][_0xb142('0x42')](_0x905606[_0xb142('0x43')],{})[_0xb142('0x1c')](respondWithResult(_0x218b45,0xc9))['catch'](handleError(_0x218b45,null));};exports[_0xb142('0x1a')]=function(_0x3b4973,_0x28a786){if(_0x3b4973[_0xb142('0x43')]['id']){delete _0x3b4973[_0xb142('0x43')]['id'];}return db[_0xb142('0x21')][_0xb142('0x40')]({'where':{'id':_0x3b4973['params']['id']}})[_0xb142('0x1c')](handleEntityNotFound(_0x28a786,null))[_0xb142('0x1c')](saveUpdates(_0x3b4973[_0xb142('0x43')],null))[_0xb142('0x1c')](respondWithResult(_0x28a786,null))['catch'](handleError(_0x28a786,null));};exports[_0xb142('0x1b')]=function(_0x26991d,_0x17b40c){return db[_0xb142('0x21')]['find']({'where':{'id':_0x26991d[_0xb142('0x3e')]['id']}})[_0xb142('0x1c')](handleEntityNotFound(_0x17b40c,null))[_0xb142('0x1c')](removeEntity(_0x17b40c,null))[_0xb142('0x41')](handleError(_0x17b40c,null));};exports[_0xb142('0x44')]=function(_0x456f92,_0x4e912a){return db[_0xb142('0x21')][_0xb142('0x44')]()[_0xb142('0x1c')](respondWithResult(_0x4e912a,null))[_0xb142('0x41')](handleError(_0x4e912a,null));};
\ No newline at end of file
+var _0xdafb=['error','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','keys','model','query','fields','attributes','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','length','create','body','find','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xdafb,0x10a));var _0xbdaf=function(_0x1ef6d0,_0x516bac){_0x1ef6d0=_0x1ef6d0-0x0;var _0x2a87e3=_0xdafb[_0x1ef6d0];return _0x2a87e3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbdaf('0x0'));var rimraf=require(_0xbdaf('0x1'));var zipdir=require(_0xbdaf('0x2'));var jsonpatch=require(_0xbdaf('0x3'));var rp=require(_0xbdaf('0x4'));var moment=require(_0xbdaf('0x5'));var BPromise=require(_0xbdaf('0x6'));var Mustache=require('mustache');var util=require(_0xbdaf('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xbdaf('0x8'));var ejs=require(_0xbdaf('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbdaf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbdaf('0xb'));var toCsv=require(_0xbdaf('0x8'));var querystring=require(_0xbdaf('0xc'));var Papa=require(_0xbdaf('0xd'));var Redis=require(_0xbdaf('0xe'));var authService=require(_0xbdaf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbdaf('0x10'));var hardwareService=require(_0xbdaf('0x11'));var logger=require(_0xbdaf('0x12'))(_0xbdaf('0x13'));var utils=require(_0xbdaf('0x14'));var config=require(_0xbdaf('0x15'));var licenseUtil=require(_0xbdaf('0x16'));var db=require(_0xbdaf('0x17'))['db'];function respondWithStatusCode(_0x23a1ee,_0x5733a0){_0x5733a0=_0x5733a0||0xcc;return function(_0x595aea){if(_0x595aea){return _0x23a1ee[_0xbdaf('0x18')](_0x5733a0);}return _0x23a1ee[_0xbdaf('0x19')](_0x5733a0)['end']();};}function respondWithResult(_0x2be207,_0x4f5d77){_0x4f5d77=_0x4f5d77||0xc8;return function(_0xacff2b){if(_0xacff2b){return _0x2be207[_0xbdaf('0x19')](_0x4f5d77)[_0xbdaf('0x1a')](_0xacff2b);}};}function respondWithFilteredResult(_0x19f919,_0x4231ae){return function(_0x56c281){if(_0x56c281){var _0x27f28c=_0x56c281[_0xbdaf('0x1b')],_0x23e927=_0x4231ae[_0xbdaf('0x1c')],_0x598587=_0x4231ae[_0xbdaf('0x1c')]+_0x4231ae[_0xbdaf('0x1d')],_0x47b8a8;if(_0x598587>=_0x27f28c){_0x598587=_0x27f28c;_0x47b8a8=0xc8;}else{_0x47b8a8=0xce;}_0x19f919['status'](_0x47b8a8);return _0x19f919[_0xbdaf('0x1e')](_0xbdaf('0x1f'),_0x23e927+'-'+_0x598587+'/'+_0x27f28c)[_0xbdaf('0x1a')](_0x56c281);}return null;};}function patchUpdates(_0x190109){return function(_0x533b3b){try{jsonpatch[_0xbdaf('0x20')](_0x533b3b,_0x190109,!![]);}catch(_0x1a0319){return BPromise[_0xbdaf('0x21')](_0x1a0319);}return _0x533b3b[_0xbdaf('0x22')]();};}function saveUpdates(_0x2e324a,_0x2a89b5){return function(_0x11cb19){if(_0x11cb19){return _0x11cb19[_0xbdaf('0x23')](_0x2e324a)[_0xbdaf('0x24')](function(_0x2d07ef){return _0x2d07ef;});}return null;};}function removeEntity(_0x160d2b,_0x3fd8ff){return function(_0x508a26){if(_0x508a26){return _0x508a26['destroy']()[_0xbdaf('0x24')](function(){_0x160d2b[_0xbdaf('0x19')](0xcc)[_0xbdaf('0x25')]();});}};}function handleEntityNotFound(_0xb11169,_0x4757ee){return function(_0x1fcc46){if(!_0x1fcc46){_0xb11169[_0xbdaf('0x18')](0x194);}return _0x1fcc46;};}function handleError(_0x31af57,_0x493506){_0x493506=_0x493506||0x1f4;return function(_0x3d88ec){logger[_0xbdaf('0x26')](_0x3d88ec['stack']);if(_0x3d88ec['name']){delete _0x3d88ec[_0xbdaf('0x27')];}_0x31af57[_0xbdaf('0x19')](_0x493506)[_0xbdaf('0x28')](_0x3d88ec);};}exports['index']=function(_0x31018e,_0x40391a){var _0x495d76={},_0x363353={},_0x57676c={'count':0x0,'rows':[]};var _0x55ddab=_[_0xbdaf('0x29')](db[_0xbdaf('0x2a')][_0xbdaf('0x2b')],function(_0x255047){return{'name':_0x255047[_0xbdaf('0x2c')],'type':_0x255047[_0xbdaf('0x2d')][_0xbdaf('0x2e')]};});_0x363353['model']=_['map'](_0x55ddab,'name');_0x363353['query']=_[_0xbdaf('0x2f')](_0x31018e['query']);_0x363353['filters']=_['intersection'](_0x363353[_0xbdaf('0x30')],_0x363353[_0xbdaf('0x31')]);_0x495d76['attributes']=_['intersection'](_0x363353[_0xbdaf('0x30')],qs['fields'](_0x31018e[_0xbdaf('0x31')][_0xbdaf('0x32')]));_0x495d76[_0xbdaf('0x33')]=_0x495d76[_0xbdaf('0x33')]['length']?_0x495d76[_0xbdaf('0x33')]:_0x363353['model'];if(!_0x31018e[_0xbdaf('0x31')]['hasOwnProperty'](_0xbdaf('0x34'))){_0x495d76[_0xbdaf('0x1d')]=qs[_0xbdaf('0x1d')](_0x31018e['query']['limit']);_0x495d76[_0xbdaf('0x1c')]=qs[_0xbdaf('0x1c')](_0x31018e[_0xbdaf('0x31')][_0xbdaf('0x1c')]);}_0x495d76[_0xbdaf('0x35')]=qs[_0xbdaf('0x36')](_0x31018e[_0xbdaf('0x31')]['sort']);_0x495d76['where']=qs[_0xbdaf('0x37')](_[_0xbdaf('0x38')](_0x31018e[_0xbdaf('0x31')],_0x363353[_0xbdaf('0x37')]),_0x55ddab);if(_0x31018e[_0xbdaf('0x31')][_0xbdaf('0x39')]){_0x495d76[_0xbdaf('0x3a')]=_[_0xbdaf('0x3b')](_0x495d76[_0xbdaf('0x3a')],{'$or':_['map'](_0x55ddab,function(_0x3d7be4){if(_0x3d7be4[_0xbdaf('0x2d')]!==_0xbdaf('0x3c')){var _0x52584e={};_0x52584e[_0x3d7be4[_0xbdaf('0x27')]]={'$like':'%'+_0x31018e[_0xbdaf('0x31')][_0xbdaf('0x39')]+'%'};return _0x52584e;}})});}_0x495d76=_[_0xbdaf('0x3b')]({},_0x495d76,_0x31018e[_0xbdaf('0x3d')]);var _0x39ccdd={'where':_0x495d76[_0xbdaf('0x3a')]};return db[_0xbdaf('0x2a')][_0xbdaf('0x1b')](_0x39ccdd)[_0xbdaf('0x24')](function(_0x3d4d9b){_0x57676c['count']=_0x3d4d9b;if(_0x31018e['query'][_0xbdaf('0x3e')]){_0x495d76[_0xbdaf('0x3f')]=[{'all':!![]}];}return db[_0xbdaf('0x2a')][_0xbdaf('0x40')](_0x495d76);})[_0xbdaf('0x24')](function(_0x293fd1){_0x57676c[_0xbdaf('0x41')]=_0x293fd1;return _0x57676c;})['then'](respondWithFilteredResult(_0x40391a,_0x495d76))[_0xbdaf('0x42')](handleError(_0x40391a,null));};exports[_0xbdaf('0x43')]=function(_0x13d09a,_0x3f361a){var _0xfb6d72={'raw':![],'where':{'id':_0x13d09a['params']['id']}},_0x4ac904={};_0x4ac904[_0xbdaf('0x30')]=_['keys'](db['UserProfileSection']['rawAttributes']);_0x4ac904[_0xbdaf('0x31')]=_['keys'](_0x13d09a['query']);_0x4ac904[_0xbdaf('0x37')]=_[_0xbdaf('0x44')](_0x4ac904[_0xbdaf('0x30')],_0x4ac904['query']);_0xfb6d72['attributes']=_[_0xbdaf('0x44')](_0x4ac904[_0xbdaf('0x30')],qs[_0xbdaf('0x32')](_0x13d09a[_0xbdaf('0x31')]['fields']));_0xfb6d72['attributes']=_0xfb6d72['attributes'][_0xbdaf('0x45')]?_0xfb6d72[_0xbdaf('0x33')]:_0x4ac904[_0xbdaf('0x30')];if(_0x13d09a[_0xbdaf('0x31')][_0xbdaf('0x3e')]){_0xfb6d72[_0xbdaf('0x3f')]=[{'all':!![]}];}_0xfb6d72=_[_0xbdaf('0x3b')]({},_0xfb6d72,_0x13d09a[_0xbdaf('0x3d')]);return db[_0xbdaf('0x2a')]['find'](_0xfb6d72)[_0xbdaf('0x24')](handleEntityNotFound(_0x3f361a,null))['then'](respondWithResult(_0x3f361a,null))[_0xbdaf('0x42')](handleError(_0x3f361a,null));};exports['create']=function(_0x563eed,_0x5a31d3){return db['UserProfileSection'][_0xbdaf('0x46')](_0x563eed[_0xbdaf('0x47')],{})['then'](respondWithResult(_0x5a31d3,0xc9))[_0xbdaf('0x42')](handleError(_0x5a31d3,null));};exports['update']=function(_0x36a0b9,_0x348bad){if(_0x36a0b9[_0xbdaf('0x47')]['id']){delete _0x36a0b9[_0xbdaf('0x47')]['id'];}return db['UserProfileSection'][_0xbdaf('0x48')]({'where':{'id':_0x36a0b9[_0xbdaf('0x49')]['id']}})['then'](handleEntityNotFound(_0x348bad,null))['then'](saveUpdates(_0x36a0b9[_0xbdaf('0x47')],null))['then'](respondWithResult(_0x348bad,null))[_0xbdaf('0x42')](handleError(_0x348bad,null));};exports[_0xbdaf('0x4a')]=function(_0x4bc26e,_0x6199dd){return db[_0xbdaf('0x2a')][_0xbdaf('0x48')]({'where':{'id':_0x4bc26e[_0xbdaf('0x49')]['id']}})[_0xbdaf('0x24')](handleEntityNotFound(_0x6199dd,null))['then'](removeEntity(_0x6199dd,null))[_0xbdaf('0x42')](handleError(_0x6199dd,null));};exports[_0xbdaf('0x4b')]=function(_0x1fa8a7,_0x1138c2){return db['UserProfileSection'][_0xbdaf('0x4b')]()[_0xbdaf('0x24')](respondWithResult(_0x1138c2,null))['catch'](handleError(_0x1138c2,null));};
\ No newline at end of file