Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / userProfileSection / userProfileSection.controller.js
index 5144509..7b8e5f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x13f5=['destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','UserProfileSection','includeAll','findAll','rows','show','include','merge','find','catch','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then'];(function(_0x1b4e63,_0x563570){var _0x1972ce=function(_0x42ec59){while(--_0x42ec59){_0x1b4e63['push'](_0x1b4e63['shift']());}};_0x1972ce(++_0x563570);}(_0x13f5,0xc3));var _0x513f=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x13f5[_0x2be8c2];return _0x97f531;};'use strict';var pdf=require(_0x513f('0x0'));var emlformat=require(_0x513f('0x1'));var rimraf=require(_0x513f('0x2'));var zipdir=require(_0x513f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x513f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x513f('0x5'));var util=require(_0x513f('0x6'));var path=require(_0x513f('0x7'));var sox=require(_0x513f('0x8'));var csv=require(_0x513f('0x9'));var ejs=require(_0x513f('0xa'));var fs=require('fs');var _=require(_0x513f('0xb'));var squel=require(_0x513f('0xc'));var crypto=require(_0x513f('0xd'));var jsforce=require(_0x513f('0xe'));var deskjs=require(_0x513f('0xf'));var toCsv=require(_0x513f('0x9'));var querystring=require('querystring');var Papa=require(_0x513f('0x10'));var Redis=require(_0x513f('0x11'));var authService=require(_0x513f('0x12'));var qs=require(_0x513f('0x13'));var as=require(_0x513f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x513f('0x15'))(_0x513f('0x16'));var utils=require('../../config/utils');var config=require(_0x513f('0x17'));var licenseUtil=require(_0x513f('0x18'));var db=require(_0x513f('0x19'))['db'];function respondWithStatusCode(_0x5f1f37,_0x476153){_0x476153=_0x476153||0xcc;return function(_0xfb8469){if(_0xfb8469){return _0x5f1f37[_0x513f('0x1a')](_0x476153);}return _0x5f1f37[_0x513f('0x1b')](_0x476153)[_0x513f('0x1c')]();};}function respondWithResult(_0x2356ab,_0x3958ab){_0x3958ab=_0x3958ab||0xc8;return function(_0x359478){if(_0x359478){return _0x2356ab[_0x513f('0x1b')](_0x3958ab)[_0x513f('0x1d')](_0x359478);}};}function respondWithFilteredResult(_0x57fd65,_0x369b25){return function(_0x4d1001){if(_0x4d1001){var _0x13f919=_0x4d1001[_0x513f('0x1e')],_0x3c4c63=_0x369b25['offset'],_0x162433=_0x369b25[_0x513f('0x1f')]+_0x369b25[_0x513f('0x20')],_0x3ea7b8;if(_0x162433>=_0x13f919){_0x162433=_0x13f919;_0x3ea7b8=0xc8;}else{_0x3ea7b8=0xce;}_0x57fd65['status'](_0x3ea7b8);return _0x57fd65[_0x513f('0x21')]('Content-Range',_0x3c4c63+'-'+_0x162433+'/'+_0x13f919)[_0x513f('0x1d')](_0x4d1001);}return null;};}function patchUpdates(_0x1d4462){return function(_0x511ae0){try{jsonpatch[_0x513f('0x22')](_0x511ae0,_0x1d4462,!![]);}catch(_0x37ccea){return BPromise[_0x513f('0x23')](_0x37ccea);}return _0x511ae0[_0x513f('0x24')]();};}function saveUpdates(_0x443dcb,_0x1e3a46){return function(_0x557390){if(_0x557390){return _0x557390[_0x513f('0x25')](_0x443dcb)[_0x513f('0x26')](function(_0x5a9e7c){return _0x5a9e7c;});}return null;};}function removeEntity(_0x1af0d6,_0x3314cf){return function(_0x7971c5){if(_0x7971c5){return _0x7971c5[_0x513f('0x27')]()[_0x513f('0x26')](function(){_0x1af0d6[_0x513f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x560835,_0x59de20){return function(_0x3d7f4d){if(!_0x3d7f4d){_0x560835[_0x513f('0x1a')](0x194);}return _0x3d7f4d;};}function handleError(_0xc3fa6f,_0x1069d4){_0x1069d4=_0x1069d4||0x1f4;return function(_0x2191d4){logger[_0x513f('0x28')](_0x2191d4[_0x513f('0x29')]);if(_0x2191d4[_0x513f('0x2a')]){delete _0x2191d4[_0x513f('0x2a')];}_0xc3fa6f['status'](_0x1069d4)[_0x513f('0x2b')](_0x2191d4);};}exports[_0x513f('0x2c')]=function(_0x27136f,_0x359d5c){var _0x58c939={},_0x3a95f8={},_0x371f9d={'count':0x0,'rows':[]};var _0x5cdcb5=_[_0x513f('0x2d')](db['UserProfileSection']['rawAttributes'],function(_0x24dc28){return{'name':_0x24dc28[_0x513f('0x2e')],'type':_0x24dc28[_0x513f('0x2f')][_0x513f('0x30')]};});_0x3a95f8['model']=_[_0x513f('0x2d')](_0x5cdcb5,_0x513f('0x2a'));_0x3a95f8[_0x513f('0x31')]=_[_0x513f('0x32')](_0x27136f['query']);_0x3a95f8[_0x513f('0x33')]=_[_0x513f('0x34')](_0x3a95f8[_0x513f('0x35')],_0x3a95f8[_0x513f('0x31')]);_0x58c939[_0x513f('0x36')]=_[_0x513f('0x34')](_0x3a95f8['model'],qs['fields'](_0x27136f[_0x513f('0x31')][_0x513f('0x37')]));_0x58c939['attributes']=_0x58c939['attributes'][_0x513f('0x38')]?_0x58c939[_0x513f('0x36')]:_0x3a95f8[_0x513f('0x35')];if(!_0x27136f['query'][_0x513f('0x39')](_0x513f('0x3a'))){_0x58c939['limit']=qs[_0x513f('0x20')](_0x27136f[_0x513f('0x31')][_0x513f('0x20')]);_0x58c939[_0x513f('0x1f')]=qs[_0x513f('0x1f')](_0x27136f[_0x513f('0x31')][_0x513f('0x1f')]);}_0x58c939[_0x513f('0x3b')]=qs[_0x513f('0x3c')](_0x27136f['query'][_0x513f('0x3c')]);_0x58c939['where']=qs['filters'](_[_0x513f('0x3d')](_0x27136f['query'],_0x3a95f8[_0x513f('0x33')]),_0x5cdcb5);if(_0x27136f[_0x513f('0x31')]['filter']){_0x58c939[_0x513f('0x3e')]=_['merge'](_0x58c939['where'],{'$or':_[_0x513f('0x2d')](_0x5cdcb5,function(_0x7db3e8){if(_0x7db3e8[_0x513f('0x2f')]!==_0x513f('0x3f')){var _0x115e04={};_0x115e04[_0x7db3e8['name']]={'$like':'%'+_0x27136f[_0x513f('0x31')][_0x513f('0x40')]+'%'};return _0x115e04;}})});}_0x58c939=_['merge']({},_0x58c939,_0x27136f[_0x513f('0x41')]);var _0x13cedc={'where':_0x58c939[_0x513f('0x3e')]};return db[_0x513f('0x42')][_0x513f('0x1e')](_0x13cedc)['then'](function(_0x7d3ffa){_0x371f9d[_0x513f('0x1e')]=_0x7d3ffa;if(_0x27136f[_0x513f('0x31')][_0x513f('0x43')]){_0x58c939['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x513f('0x44')](_0x58c939);})[_0x513f('0x26')](function(_0x3b5e7b){_0x371f9d[_0x513f('0x45')]=_0x3b5e7b;return _0x371f9d;})['then'](respondWithFilteredResult(_0x359d5c,_0x58c939))['catch'](handleError(_0x359d5c,null));};exports[_0x513f('0x46')]=function(_0x1b1820,_0x4265da){var _0x27c342={'raw':![],'where':{'id':_0x1b1820['params']['id']}},_0x17733b={};_0x17733b[_0x513f('0x35')]=_[_0x513f('0x32')](db[_0x513f('0x42')]['rawAttributes']);_0x17733b[_0x513f('0x31')]=_[_0x513f('0x32')](_0x1b1820['query']);_0x17733b[_0x513f('0x33')]=_[_0x513f('0x34')](_0x17733b[_0x513f('0x35')],_0x17733b[_0x513f('0x31')]);_0x27c342[_0x513f('0x36')]=_['intersection'](_0x17733b[_0x513f('0x35')],qs[_0x513f('0x37')](_0x1b1820[_0x513f('0x31')][_0x513f('0x37')]));_0x27c342['attributes']=_0x27c342['attributes'][_0x513f('0x38')]?_0x27c342[_0x513f('0x36')]:_0x17733b[_0x513f('0x35')];if(_0x1b1820[_0x513f('0x31')][_0x513f('0x43')]){_0x27c342[_0x513f('0x47')]=[{'all':!![]}];}_0x27c342=_[_0x513f('0x48')]({},_0x27c342,_0x1b1820['options']);return db[_0x513f('0x42')][_0x513f('0x49')](_0x27c342)[_0x513f('0x26')](handleEntityNotFound(_0x4265da,null))['then'](respondWithResult(_0x4265da,null))[_0x513f('0x4a')](handleError(_0x4265da,null));};exports['create']=function(_0x45263f,_0x4b4d0c){return db[_0x513f('0x42')]['create'](_0x45263f[_0x513f('0x4b')],{})[_0x513f('0x26')](respondWithResult(_0x4b4d0c,0xc9))[_0x513f('0x4a')](handleError(_0x4b4d0c,null));};exports['update']=function(_0x1fed87,_0x49a0af){if(_0x1fed87[_0x513f('0x4b')]['id']){delete _0x1fed87[_0x513f('0x4b')]['id'];}return db['UserProfileSection'][_0x513f('0x49')]({'where':{'id':_0x1fed87[_0x513f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x49a0af,null))[_0x513f('0x26')](saveUpdates(_0x1fed87[_0x513f('0x4b')],null))['then'](respondWithResult(_0x49a0af,null))[_0x513f('0x4a')](handleError(_0x49a0af,null));};exports['destroy']=function(_0x1a3d47,_0x49f353){return db[_0x513f('0x42')]['find']({'where':{'id':_0x1a3d47[_0x513f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x49f353,null))[_0x513f('0x26')](removeEntity(_0x49f353,null))['catch'](handleError(_0x49f353,null));};exports[_0x513f('0x4d')]=function(_0x56737f,_0x56a508){return db[_0x513f('0x42')][_0x513f('0x4d')]()['then'](respondWithResult(_0x56a508,null))[_0x513f('0x4a')](handleError(_0x56a508,null));};
\ No newline at end of file
+var _0x5299=['count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit'];(function(_0x3fb5a8,_0x57d3f6){var _0x519841=function(_0x35c08a){while(--_0x35c08a){_0x3fb5a8['push'](_0x3fb5a8['shift']());}};_0x519841(++_0x57d3f6);}(_0x5299,0x196));var _0x9529=function(_0x5c6b7f,_0x2fda00){_0x5c6b7f=_0x5c6b7f-0x0;var _0x384fc5=_0x5299[_0x5c6b7f];return _0x384fc5;};'use strict';var emlformat=require(_0x9529('0x0'));var rimraf=require(_0x9529('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9529('0x2'));var rp=require(_0x9529('0x3'));var moment=require(_0x9529('0x4'));var BPromise=require(_0x9529('0x5'));var Mustache=require(_0x9529('0x6'));var util=require(_0x9529('0x7'));var path=require(_0x9529('0x8'));var sox=require('sox');var csv=require(_0x9529('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9529('0xa'));var _=require(_0x9529('0xb'));var squel=require('squel');var crypto=require(_0x9529('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9529('0x9'));var querystring=require(_0x9529('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9529('0xe'));var qs=require(_0x9529('0xf'));var as=require(_0x9529('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9529('0x11'))(_0x9529('0x12'));var utils=require('../../config/utils');var config=require(_0x9529('0x13'));var licenseUtil=require(_0x9529('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1418d8,_0x85866a){_0x85866a=_0x85866a||0xcc;return function(_0x5afcae){if(_0x5afcae){return _0x1418d8['sendStatus'](_0x85866a);}return _0x1418d8[_0x9529('0x15')](_0x85866a)['end']();};}function respondWithResult(_0xb65cf3,_0x5cc45a){_0x5cc45a=_0x5cc45a||0xc8;return function(_0x1d9f62){if(_0x1d9f62){return _0xb65cf3[_0x9529('0x15')](_0x5cc45a)[_0x9529('0x16')](_0x1d9f62);}};}function respondWithFilteredResult(_0x304826,_0x437691){return function(_0x472ff4){if(_0x472ff4){var _0x4fa936=typeof _0x437691[_0x9529('0x17')]===_0x9529('0x18')&&typeof _0x437691[_0x9529('0x19')]==='undefined';var _0x2e7ae3=_0x472ff4[_0x9529('0x1a')];var _0x44de48=_0x4fa936?0x0:_0x437691[_0x9529('0x17')];var _0x17b167=_0x4fa936?_0x472ff4[_0x9529('0x1a')]:_0x437691['offset']+_0x437691[_0x9529('0x19')];var _0x3c585d;if(_0x17b167>=_0x2e7ae3){_0x17b167=_0x2e7ae3;_0x3c585d=0xc8;}else{_0x3c585d=0xce;}_0x304826[_0x9529('0x15')](_0x3c585d);return _0x304826[_0x9529('0x1b')](_0x9529('0x1c'),_0x44de48+'-'+_0x17b167+'/'+_0x2e7ae3)['json'](_0x472ff4);}return null;};}function patchUpdates(_0x42303b){return function(_0x1ad6ce){try{jsonpatch[_0x9529('0x1d')](_0x1ad6ce,_0x42303b,!![]);}catch(_0x1f86d2){return BPromise['reject'](_0x1f86d2);}return _0x1ad6ce[_0x9529('0x1e')]();};}function saveUpdates(_0xb7a25d,_0x46a94f){return function(_0x286ece){if(_0x286ece){return _0x286ece[_0x9529('0x1f')](_0xb7a25d)[_0x9529('0x20')](function(_0x4ab38c){return _0x4ab38c;});}return null;};}function removeEntity(_0x1fa8a8,_0x441216){return function(_0xf5f4c3){if(_0xf5f4c3){return _0xf5f4c3[_0x9529('0x21')]()[_0x9529('0x20')](function(){_0x1fa8a8[_0x9529('0x15')](0xcc)[_0x9529('0x22')]();});}};}function handleEntityNotFound(_0x37add3,_0x20bb7a){return function(_0x40366d){if(!_0x40366d){_0x37add3[_0x9529('0x23')](0x194);}return _0x40366d;};}function handleError(_0x2a3e74,_0x2ca49a){_0x2ca49a=_0x2ca49a||0x1f4;return function(_0x4aea6a){logger['error'](_0x4aea6a[_0x9529('0x24')]);if(_0x4aea6a[_0x9529('0x25')]){delete _0x4aea6a['name'];}_0x2a3e74[_0x9529('0x15')](_0x2ca49a)[_0x9529('0x26')](_0x4aea6a);};}exports['index']=function(_0x487353,_0x21cd4e){var _0x3c1302={},_0x25dd08={},_0x136246={'count':0x0,'rows':[]};var _0xc04423=_[_0x9529('0x27')](db[_0x9529('0x28')][_0x9529('0x29')],function(_0x2be54c){return{'name':_0x2be54c[_0x9529('0x2a')],'type':_0x2be54c['type'][_0x9529('0x2b')]};});_0x25dd08['model']=_[_0x9529('0x27')](_0xc04423,'name');_0x25dd08[_0x9529('0x2c')]=_[_0x9529('0x2d')](_0x487353[_0x9529('0x2c')]);_0x25dd08[_0x9529('0x2e')]=_[_0x9529('0x2f')](_0x25dd08[_0x9529('0x30')],_0x25dd08[_0x9529('0x2c')]);_0x3c1302[_0x9529('0x31')]=_['intersection'](_0x25dd08[_0x9529('0x30')],qs[_0x9529('0x32')](_0x487353[_0x9529('0x2c')][_0x9529('0x32')]));_0x3c1302['attributes']=_0x3c1302[_0x9529('0x31')][_0x9529('0x33')]?_0x3c1302[_0x9529('0x31')]:_0x25dd08[_0x9529('0x30')];if(!_0x487353[_0x9529('0x2c')]['hasOwnProperty'](_0x9529('0x34'))){_0x3c1302[_0x9529('0x19')]=qs['limit'](_0x487353[_0x9529('0x2c')][_0x9529('0x19')]);_0x3c1302['offset']=qs[_0x9529('0x17')](_0x487353['query'][_0x9529('0x17')]);}_0x3c1302['order']=qs[_0x9529('0x35')](_0x487353[_0x9529('0x2c')][_0x9529('0x35')]);_0x3c1302['where']=qs['filters'](_[_0x9529('0x36')](_0x487353['query'],_0x25dd08[_0x9529('0x2e')]),_0xc04423);if(_0x487353['query'][_0x9529('0x37')]){_0x3c1302['where']=_[_0x9529('0x38')](_0x3c1302[_0x9529('0x39')],{'$or':_[_0x9529('0x27')](_0xc04423,function(_0x401b05){if(_0x401b05[_0x9529('0x3a')]!==_0x9529('0x3b')){var _0x256b51={};_0x256b51[_0x401b05[_0x9529('0x25')]]={'$like':'%'+_0x487353[_0x9529('0x2c')][_0x9529('0x37')]+'%'};return _0x256b51;}})});}_0x3c1302=_[_0x9529('0x38')]({},_0x3c1302,_0x487353[_0x9529('0x3c')]);var _0x495989={'where':_0x3c1302[_0x9529('0x39')]};return db[_0x9529('0x28')][_0x9529('0x1a')](_0x495989)[_0x9529('0x20')](function(_0x299baf){_0x136246['count']=_0x299baf;if(_0x487353[_0x9529('0x2c')][_0x9529('0x3d')]){_0x3c1302['include']=[{'all':!![]}];}return db[_0x9529('0x28')][_0x9529('0x3e')](_0x3c1302);})[_0x9529('0x20')](function(_0x4b2685){_0x136246[_0x9529('0x3f')]=_0x4b2685;return _0x136246;})['then'](respondWithFilteredResult(_0x21cd4e,_0x3c1302))[_0x9529('0x40')](handleError(_0x21cd4e,null));};exports[_0x9529('0x41')]=function(_0x22fbc8,_0x231177){var _0x35b909={'raw':![],'where':{'id':_0x22fbc8[_0x9529('0x42')]['id']}},_0x531c62={};_0x531c62[_0x9529('0x30')]=_[_0x9529('0x2d')](db[_0x9529('0x28')][_0x9529('0x29')]);_0x531c62['query']=_[_0x9529('0x2d')](_0x22fbc8[_0x9529('0x2c')]);_0x531c62[_0x9529('0x2e')]=_[_0x9529('0x2f')](_0x531c62['model'],_0x531c62[_0x9529('0x2c')]);_0x35b909[_0x9529('0x31')]=_[_0x9529('0x2f')](_0x531c62[_0x9529('0x30')],qs[_0x9529('0x32')](_0x22fbc8[_0x9529('0x2c')][_0x9529('0x32')]));_0x35b909[_0x9529('0x31')]=_0x35b909[_0x9529('0x31')][_0x9529('0x33')]?_0x35b909[_0x9529('0x31')]:_0x531c62['model'];if(_0x22fbc8[_0x9529('0x2c')][_0x9529('0x3d')]){_0x35b909[_0x9529('0x43')]=[{'all':!![]}];}_0x35b909=_[_0x9529('0x38')]({},_0x35b909,_0x22fbc8['options']);return db['UserProfileSection']['find'](_0x35b909)['then'](handleEntityNotFound(_0x231177,null))[_0x9529('0x20')](respondWithResult(_0x231177,null))[_0x9529('0x40')](handleError(_0x231177,null));};exports['create']=function(_0x1b71de,_0x4c61bd){return db[_0x9529('0x28')][_0x9529('0x44')](_0x1b71de[_0x9529('0x45')],{})[_0x9529('0x20')](respondWithResult(_0x4c61bd,0xc9))[_0x9529('0x40')](handleError(_0x4c61bd,null));};exports[_0x9529('0x1f')]=function(_0x511cde,_0x4d7928){if(_0x511cde[_0x9529('0x45')]['id']){delete _0x511cde[_0x9529('0x45')]['id'];}return db[_0x9529('0x28')][_0x9529('0x46')]({'where':{'id':_0x511cde[_0x9529('0x42')]['id']}})[_0x9529('0x20')](handleEntityNotFound(_0x4d7928,null))['then'](saveUpdates(_0x511cde[_0x9529('0x45')],null))[_0x9529('0x20')](respondWithResult(_0x4d7928,null))['catch'](handleError(_0x4d7928,null));};exports['destroy']=function(_0x22b3f5,_0x4cac08){return db[_0x9529('0x28')][_0x9529('0x46')]({'where':{'id':_0x22b3f5[_0x9529('0x42')]['id']}})[_0x9529('0x20')](handleEntityNotFound(_0x4cac08,null))['then'](removeEntity(_0x4cac08,null))[_0x9529('0x40')](handleError(_0x4cac08,null));};exports[_0x9529('0x47')]=function(_0x158f08,_0x511f9a){return db[_0x9529('0x28')][_0x9529('0x47')]()[_0x9529('0x20')](respondWithResult(_0x511f9a,null))[_0x9529('0x40')](handleError(_0x511f9a,null));};
\ No newline at end of file