Built motion from commit (unavailable).|2.5.25
[motion2.git] / server / api / userProfileSection / userProfileSection.controller.js
index d6de0a9..5144509 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4a97=['describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','UserProfileSection','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','includeAll','rows','params','rawAttributes','intersection','include','find','create','catch','body'];(function(_0x235c90,_0x5ae023){var _0x527e1a=function(_0x323bc1){while(--_0x323bc1){_0x235c90['push'](_0x235c90['shift']());}};_0x527e1a(++_0x5ae023);}(_0x4a97,0x1eb));var _0x74a9=function(_0x54da5b,_0x12fd71){_0x54da5b=_0x54da5b-0x0;var _0x285d3b=_0x4a97[_0x54da5b];return _0x285d3b;};'use strict';var pdf=require(_0x74a9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x74a9('0x1'));var zipdir=require(_0x74a9('0x2'));var jsonpatch=require(_0x74a9('0x3'));var rp=require(_0x74a9('0x4'));var moment=require('moment');var BPromise=require(_0x74a9('0x5'));var Mustache=require('mustache');var util=require(_0x74a9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x74a9('0x7'));var ejs=require(_0x74a9('0x8'));var fs=require('fs');var _=require(_0x74a9('0x9'));var squel=require(_0x74a9('0xa'));var crypto=require(_0x74a9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x74a9('0xc'));var toCsv=require(_0x74a9('0x7'));var querystring=require(_0x74a9('0xd'));var Papa=require(_0x74a9('0xe'));var Redis=require(_0x74a9('0xf'));var authService=require(_0x74a9('0x10'));var qs=require(_0x74a9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74a9('0x12'));var logger=require(_0x74a9('0x13'))('api');var utils=require(_0x74a9('0x14'));var config=require('../../config/environment');var db=require(_0x74a9('0x15'))['db'];function respondWithStatusCode(_0x4f8ea2,_0x2c7449){_0x2c7449=_0x2c7449||0xcc;return function(_0x30c94b){if(_0x30c94b){return _0x4f8ea2[_0x74a9('0x16')](_0x2c7449);}return _0x4f8ea2[_0x74a9('0x17')](_0x2c7449)[_0x74a9('0x18')]();};}function respondWithResult(_0x493abc,_0x109dc9){_0x109dc9=_0x109dc9||0xc8;return function(_0x2e85c5){if(_0x2e85c5){return _0x493abc[_0x74a9('0x17')](_0x109dc9)[_0x74a9('0x19')](_0x2e85c5);}};}function respondWithFilteredResult(_0x22f02c,_0x164834){return function(_0x25f9e5){if(_0x25f9e5){var _0xedb55f=_0x25f9e5[_0x74a9('0x1a')],_0x41a640=_0x164834['offset'],_0x366759=_0x164834['offset']+_0x164834[_0x74a9('0x1b')],_0x517a44;if(_0x366759>=_0xedb55f){_0x366759=_0xedb55f;_0x517a44=0xc8;}else{_0x517a44=0xce;}_0x22f02c[_0x74a9('0x17')](_0x517a44);return _0x22f02c['set'](_0x74a9('0x1c'),_0x41a640+'-'+_0x366759+'/'+_0xedb55f)['json'](_0x25f9e5);}return null;};}function patchUpdates(_0x5bbc6a){return function(_0x2c7c7e){try{jsonpatch[_0x74a9('0x1d')](_0x2c7c7e,_0x5bbc6a,!![]);}catch(_0xfd13df){return BPromise[_0x74a9('0x1e')](_0xfd13df);}return _0x2c7c7e[_0x74a9('0x1f')]();};}function saveUpdates(_0x35c5c5,_0x5bc81b){return function(_0x5b1171){if(_0x5b1171){return _0x5b1171[_0x74a9('0x20')](_0x35c5c5)[_0x74a9('0x21')](function(_0x4dbd32){return _0x4dbd32;});}return null;};}function removeEntity(_0x2608f2,_0x5d803c){return function(_0xb0beaa){if(_0xb0beaa){return _0xb0beaa[_0x74a9('0x22')]()[_0x74a9('0x21')](function(){_0x2608f2['status'](0xcc)[_0x74a9('0x18')]();});}};}function handleEntityNotFound(_0x1a20a4,_0x29ed05){return function(_0x20e814){if(!_0x20e814){_0x1a20a4[_0x74a9('0x16')](0x194);}return _0x20e814;};}function handleError(_0x42e080,_0x2b597e){_0x2b597e=_0x2b597e||0x1f4;return function(_0x5105be){logger['error'](_0x5105be[_0x74a9('0x23')]);if(_0x5105be[_0x74a9('0x24')]){delete _0x5105be[_0x74a9('0x24')];}_0x42e080['status'](_0x2b597e)[_0x74a9('0x25')](_0x5105be);};}exports[_0x74a9('0x26')]=function(_0x438288,_0x411363){var _0x40e5a3={},_0x257173={},_0x3adf2c={'count':0x0,'rows':[]};var _0x249293=_[_0x74a9('0x27')](db[_0x74a9('0x28')]['rawAttributes'],function(_0x5ca53e){return{'name':_0x5ca53e[_0x74a9('0x29')],'type':_0x5ca53e[_0x74a9('0x2a')][_0x74a9('0x2b')]};});_0x257173[_0x74a9('0x2c')]=_[_0x74a9('0x27')](_0x249293,_0x74a9('0x24'));_0x257173[_0x74a9('0x2d')]=_[_0x74a9('0x2e')](_0x438288[_0x74a9('0x2d')]);_0x257173[_0x74a9('0x2f')]=_['intersection'](_0x257173[_0x74a9('0x2c')],_0x257173[_0x74a9('0x2d')]);_0x40e5a3['attributes']=_['intersection'](_0x257173['model'],qs[_0x74a9('0x30')](_0x438288[_0x74a9('0x2d')][_0x74a9('0x30')]));_0x40e5a3[_0x74a9('0x31')]=_0x40e5a3[_0x74a9('0x31')]['length']?_0x40e5a3[_0x74a9('0x31')]:_0x257173[_0x74a9('0x2c')];if(!_0x438288[_0x74a9('0x2d')][_0x74a9('0x32')](_0x74a9('0x33'))){_0x40e5a3['limit']=qs[_0x74a9('0x1b')](_0x438288[_0x74a9('0x2d')][_0x74a9('0x1b')]);_0x40e5a3['offset']=qs[_0x74a9('0x34')](_0x438288['query'][_0x74a9('0x34')]);}_0x40e5a3[_0x74a9('0x35')]=qs['sort'](_0x438288[_0x74a9('0x2d')][_0x74a9('0x36')]);_0x40e5a3[_0x74a9('0x37')]=qs[_0x74a9('0x2f')](_['pick'](_0x438288[_0x74a9('0x2d')],_0x257173[_0x74a9('0x2f')]),_0x249293);if(_0x438288['query'][_0x74a9('0x38')]){_0x40e5a3['where']=_[_0x74a9('0x39')](_0x40e5a3[_0x74a9('0x37')],{'$or':_['map'](_0x249293,function(_0x247e69){if(_0x247e69['type']!==_0x74a9('0x3a')){var _0x122ec1={};_0x122ec1[_0x247e69[_0x74a9('0x24')]]={'$like':'%'+_0x438288['query'][_0x74a9('0x38')]+'%'};return _0x122ec1;}})});}_0x40e5a3=_[_0x74a9('0x39')]({},_0x40e5a3,_0x438288['options']);var _0x3ffc25={'where':_0x40e5a3[_0x74a9('0x37')]};return db[_0x74a9('0x28')][_0x74a9('0x1a')](_0x3ffc25)[_0x74a9('0x21')](function(_0x30297e){_0x3adf2c['count']=_0x30297e;if(_0x438288[_0x74a9('0x2d')][_0x74a9('0x3b')]){_0x40e5a3['include']=[{'all':!![]}];}return db[_0x74a9('0x28')]['findAll'](_0x40e5a3);})[_0x74a9('0x21')](function(_0x8304fc){_0x3adf2c[_0x74a9('0x3c')]=_0x8304fc;return _0x3adf2c;})[_0x74a9('0x21')](respondWithFilteredResult(_0x411363,_0x40e5a3))['catch'](handleError(_0x411363,null));};exports['show']=function(_0x2b6328,_0x1db6d9){var _0x4684a1={'raw':![],'where':{'id':_0x2b6328[_0x74a9('0x3d')]['id']}},_0x554b5c={};_0x554b5c['model']=_[_0x74a9('0x2e')](db[_0x74a9('0x28')][_0x74a9('0x3e')]);_0x554b5c[_0x74a9('0x2d')]=_[_0x74a9('0x2e')](_0x2b6328[_0x74a9('0x2d')]);_0x554b5c['filters']=_[_0x74a9('0x3f')](_0x554b5c[_0x74a9('0x2c')],_0x554b5c[_0x74a9('0x2d')]);_0x4684a1[_0x74a9('0x31')]=_[_0x74a9('0x3f')](_0x554b5c[_0x74a9('0x2c')],qs['fields'](_0x2b6328['query'][_0x74a9('0x30')]));_0x4684a1[_0x74a9('0x31')]=_0x4684a1['attributes']['length']?_0x4684a1[_0x74a9('0x31')]:_0x554b5c[_0x74a9('0x2c')];if(_0x2b6328[_0x74a9('0x2d')][_0x74a9('0x3b')]){_0x4684a1[_0x74a9('0x40')]=[{'all':!![]}];}_0x4684a1=_[_0x74a9('0x39')]({},_0x4684a1,_0x2b6328['options']);return db[_0x74a9('0x28')][_0x74a9('0x41')](_0x4684a1)[_0x74a9('0x21')](handleEntityNotFound(_0x1db6d9,null))[_0x74a9('0x21')](respondWithResult(_0x1db6d9,null))['catch'](handleError(_0x1db6d9,null));};exports[_0x74a9('0x42')]=function(_0x4eb632,_0x27eca0){return db[_0x74a9('0x28')][_0x74a9('0x42')](_0x4eb632['body'],{})[_0x74a9('0x21')](respondWithResult(_0x27eca0,0xc9))[_0x74a9('0x43')](handleError(_0x27eca0,null));};exports[_0x74a9('0x20')]=function(_0x1a9735,_0x42e874){if(_0x1a9735[_0x74a9('0x44')]['id']){delete _0x1a9735[_0x74a9('0x44')]['id'];}return db[_0x74a9('0x28')]['find']({'where':{'id':_0x1a9735[_0x74a9('0x3d')]['id']}})[_0x74a9('0x21')](handleEntityNotFound(_0x42e874,null))[_0x74a9('0x21')](saveUpdates(_0x1a9735[_0x74a9('0x44')],null))[_0x74a9('0x21')](respondWithResult(_0x42e874,null))['catch'](handleError(_0x42e874,null));};exports[_0x74a9('0x22')]=function(_0x97d4a7,_0x1796e3){return db[_0x74a9('0x28')][_0x74a9('0x41')]({'where':{'id':_0x97d4a7['params']['id']}})['then'](handleEntityNotFound(_0x1796e3,null))['then'](removeEntity(_0x1796e3,null))[_0x74a9('0x43')](handleError(_0x1796e3,null));};exports[_0x74a9('0x45')]=function(_0x5d5331,_0xd71be4){return db[_0x74a9('0x28')][_0x74a9('0x45')]()['then'](respondWithResult(_0xd71be4,null))[_0x74a9('0x43')](handleError(_0xd71be4,null));};
\ No newline at end of file
+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