Built motion from commit c0cdc9d8.|2.6.28
[motion2.git] / server / api / template / template.controller.js
index 7cf32e8..460bcb4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x88f1=['includeAll','findAll','rows','keys','find','catch','create','body','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','destroy','then','Templates','UserProfileResource','end','name','send','index','map','Template','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0x88f1,0xa2));var _0x188f=function(_0x257875,_0x5b01ec){_0x257875=_0x257875-0x0;var _0x13a4cd=_0x88f1[_0x257875];return _0x13a4cd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x188f('0x0'));var zipdir=require(_0x188f('0x1'));var jsonpatch=require(_0x188f('0x2'));var rp=require(_0x188f('0x3'));var moment=require(_0x188f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x188f('0x5'));var util=require(_0x188f('0x6'));var path=require(_0x188f('0x7'));var sox=require('sox');var csv=require(_0x188f('0x8'));var ejs=require(_0x188f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x188f('0xa'));var squel=require(_0x188f('0xb'));var crypto=require(_0x188f('0xc'));var jsforce=require(_0x188f('0xd'));var deskjs=require(_0x188f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x188f('0xf'));var Papa=require('papaparse');var Redis=require(_0x188f('0x10'));var authService=require(_0x188f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x188f('0x12'))('api');var utils=require(_0x188f('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x188f('0x14'))['db'];function respondWithStatusCode(_0x309f4b,_0x350566){_0x350566=_0x350566||0xcc;return function(_0x2e5675){if(_0x2e5675){return _0x309f4b[_0x188f('0x15')](_0x350566);}return _0x309f4b[_0x188f('0x16')](_0x350566)['end']();};}function respondWithResult(_0xa0f47d,_0x43e4fa){_0x43e4fa=_0x43e4fa||0xc8;return function(_0x6f0061){if(_0x6f0061){return _0xa0f47d['status'](_0x43e4fa)[_0x188f('0x17')](_0x6f0061);}};}function respondWithFilteredResult(_0x5cdad4,_0x13160e){return function(_0x33524c){if(_0x33524c){var _0x2cb9f8=typeof _0x13160e[_0x188f('0x18')]===_0x188f('0x19')&&typeof _0x13160e['limit']===_0x188f('0x19');var _0x5c38ff=_0x33524c['count'];var _0x1ec586=_0x2cb9f8?0x0:_0x13160e[_0x188f('0x18')];var _0x8dc5ce=_0x2cb9f8?_0x33524c[_0x188f('0x1a')]:_0x13160e[_0x188f('0x18')]+_0x13160e[_0x188f('0x1b')];var _0x8a19f0;if(_0x8dc5ce>=_0x5c38ff){_0x8dc5ce=_0x5c38ff;_0x8a19f0=0xc8;}else{_0x8a19f0=0xce;}_0x5cdad4[_0x188f('0x16')](_0x8a19f0);return _0x5cdad4[_0x188f('0x1c')]('Content-Range',_0x1ec586+'-'+_0x8dc5ce+'/'+_0x5c38ff)[_0x188f('0x17')](_0x33524c);}return null;};}function patchUpdates(_0x40c2be){return function(_0x3fb0d5){try{jsonpatch[_0x188f('0x1d')](_0x3fb0d5,_0x40c2be,!![]);}catch(_0x4f9c3e){return BPromise[_0x188f('0x1e')](_0x4f9c3e);}return _0x3fb0d5['save']();};}function saveUpdates(_0x32e79d,_0xd3bb6b){return function(_0x575780){if(_0x575780){return _0x575780['update'](_0x32e79d)['then'](function(_0x54bc0e){return _0x54bc0e;});}return null;};}function removeEntity(_0x19c4c6,_0x1a9079){return function(_0x4ec8ca){if(_0x4ec8ca){return _0x4ec8ca[_0x188f('0x1f')]()[_0x188f('0x20')](function(){var _0x1194ad=_0x4ec8ca['get']({'plain':!![]});var _0x6c5db2=_0x188f('0x21');return db[_0x188f('0x22')][_0x188f('0x1f')]({'where':{'type':_0x6c5db2,'resourceId':_0x1194ad['id']}})[_0x188f('0x20')](function(){return _0x4ec8ca;});})[_0x188f('0x20')](function(){_0x19c4c6['status'](0xcc)[_0x188f('0x23')]();});}};}function handleEntityNotFound(_0x3be13d,_0x41c7b7){return function(_0x2e70d4){if(!_0x2e70d4){_0x3be13d['sendStatus'](0x194);}return _0x2e70d4;};}function handleError(_0x24b16e,_0x3a7ec6){_0x3a7ec6=_0x3a7ec6||0x1f4;return function(_0x2d2d41){logger['error'](_0x2d2d41['stack']);if(_0x2d2d41['name']){delete _0x2d2d41[_0x188f('0x24')];}_0x24b16e['status'](_0x3a7ec6)[_0x188f('0x25')](_0x2d2d41);};}exports[_0x188f('0x26')]=function(_0x4b7e87,_0x3cb006){var _0x1ee70e={},_0x3de3c3={},_0x2b7ff8={'count':0x0,'rows':[]};var _0x2c689a=_[_0x188f('0x27')](db[_0x188f('0x28')]['rawAttributes'],function(_0x13d8d1){return{'name':_0x13d8d1[_0x188f('0x29')],'type':_0x13d8d1[_0x188f('0x2a')][_0x188f('0x2b')]};});_0x3de3c3[_0x188f('0x2c')]=_[_0x188f('0x27')](_0x2c689a,_0x188f('0x24'));_0x3de3c3[_0x188f('0x2d')]=_['keys'](_0x4b7e87[_0x188f('0x2d')]);_0x3de3c3[_0x188f('0x2e')]=_[_0x188f('0x2f')](_0x3de3c3[_0x188f('0x2c')],_0x3de3c3[_0x188f('0x2d')]);_0x1ee70e['attributes']=_[_0x188f('0x2f')](_0x3de3c3[_0x188f('0x2c')],qs[_0x188f('0x30')](_0x4b7e87['query'][_0x188f('0x30')]));_0x1ee70e[_0x188f('0x31')]=_0x1ee70e[_0x188f('0x31')]['length']?_0x1ee70e[_0x188f('0x31')]:_0x3de3c3[_0x188f('0x2c')];if(!_0x4b7e87[_0x188f('0x2d')][_0x188f('0x32')](_0x188f('0x33'))){_0x1ee70e[_0x188f('0x1b')]=qs[_0x188f('0x1b')](_0x4b7e87[_0x188f('0x2d')]['limit']);_0x1ee70e['offset']=qs['offset'](_0x4b7e87['query'][_0x188f('0x18')]);}_0x1ee70e[_0x188f('0x34')]=qs[_0x188f('0x35')](_0x4b7e87['query'][_0x188f('0x35')]);_0x1ee70e[_0x188f('0x36')]=qs[_0x188f('0x2e')](_[_0x188f('0x37')](_0x4b7e87[_0x188f('0x2d')],_0x3de3c3[_0x188f('0x2e')]),_0x2c689a);if(_0x4b7e87[_0x188f('0x2d')][_0x188f('0x38')]){_0x1ee70e[_0x188f('0x36')]=_['merge'](_0x1ee70e[_0x188f('0x36')],{'$or':_['map'](_0x2c689a,function(_0x571674){if(_0x571674['type']!==_0x188f('0x39')){var _0x1a8aee={};_0x1a8aee[_0x571674[_0x188f('0x24')]]={'$like':'%'+_0x4b7e87[_0x188f('0x2d')][_0x188f('0x38')]+'%'};return _0x1a8aee;}})});}_0x1ee70e=_[_0x188f('0x3a')]({},_0x1ee70e,_0x4b7e87[_0x188f('0x3b')]);var _0x4cf5de={'where':_0x1ee70e['where']};return db[_0x188f('0x28')][_0x188f('0x1a')](_0x4cf5de)['then'](function(_0x582344){_0x2b7ff8[_0x188f('0x1a')]=_0x582344;if(_0x4b7e87[_0x188f('0x2d')][_0x188f('0x3c')]){_0x1ee70e['include']=[{'all':!![]}];}return db[_0x188f('0x28')][_0x188f('0x3d')](_0x1ee70e);})[_0x188f('0x20')](function(_0xaf3f75){_0x2b7ff8[_0x188f('0x3e')]=_0xaf3f75;return _0x2b7ff8;})[_0x188f('0x20')](respondWithFilteredResult(_0x3cb006,_0x1ee70e))['catch'](handleError(_0x3cb006,null));};exports['show']=function(_0x210661,_0x79e40){var _0x46f3ab={'raw':!![],'where':{'id':_0x210661['params']['id']}},_0x27f11f={};_0x27f11f[_0x188f('0x2c')]=_[_0x188f('0x3f')](db[_0x188f('0x28')]['rawAttributes']);_0x27f11f[_0x188f('0x2d')]=_[_0x188f('0x3f')](_0x210661['query']);_0x27f11f[_0x188f('0x2e')]=_[_0x188f('0x2f')](_0x27f11f[_0x188f('0x2c')],_0x27f11f[_0x188f('0x2d')]);_0x46f3ab[_0x188f('0x31')]=_[_0x188f('0x2f')](_0x27f11f['model'],qs[_0x188f('0x30')](_0x210661[_0x188f('0x2d')][_0x188f('0x30')]));_0x46f3ab[_0x188f('0x31')]=_0x46f3ab['attributes']['length']?_0x46f3ab['attributes']:_0x27f11f[_0x188f('0x2c')];if(_0x210661[_0x188f('0x2d')][_0x188f('0x3c')]){_0x46f3ab['include']=[{'all':!![]}];}_0x46f3ab=_[_0x188f('0x3a')]({},_0x46f3ab,_0x210661[_0x188f('0x3b')]);return db[_0x188f('0x28')][_0x188f('0x40')](_0x46f3ab)[_0x188f('0x20')](handleEntityNotFound(_0x79e40,null))['then'](respondWithResult(_0x79e40,null))[_0x188f('0x41')](handleError(_0x79e40,null));};exports[_0x188f('0x42')]=function(_0x55a314,_0x55bb04){return db[_0x188f('0x28')][_0x188f('0x42')](_0x55a314[_0x188f('0x43')],{})[_0x188f('0x20')](function(_0x26f757){var _0x5e944a=_0x55a314[_0x188f('0x44')]['get']({'plain':!![]});if(!_0x5e944a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e944a['role']===_0x188f('0x44')){var _0x584143=_0x26f757['get']({'plain':!![]});var _0x1e43d6=_0x188f('0x21');return db[_0x188f('0x45')]['find']({'where':{'name':_0x1e43d6,'userProfileId':_0x5e944a['userProfileId']},'raw':!![]})[_0x188f('0x20')](function(_0x220214){if(_0x220214&&_0x220214[_0x188f('0x46')]===0x0){return db[_0x188f('0x22')][_0x188f('0x42')]({'name':_0x584143[_0x188f('0x24')],'resourceId':_0x584143['id'],'type':_0x220214[_0x188f('0x24')],'sectionId':_0x220214['id']},{})[_0x188f('0x20')](function(){return _0x26f757;});}else{return _0x26f757;}})['catch'](function(_0x2fa119){logger[_0x188f('0x47')](_0x188f('0x48'),_0x2fa119);throw _0x2fa119;});}return _0x26f757;})[_0x188f('0x20')](respondWithResult(_0x55bb04,0xc9))[_0x188f('0x41')](handleError(_0x55bb04,null));};exports['update']=function(_0x1eb2fe,_0x1e7a2b){if(_0x1eb2fe['body']['id']){delete _0x1eb2fe[_0x188f('0x43')]['id'];}return db[_0x188f('0x28')][_0x188f('0x40')]({'where':{'id':_0x1eb2fe[_0x188f('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e7a2b,null))[_0x188f('0x20')](saveUpdates(_0x1eb2fe['body'],null))[_0x188f('0x20')](respondWithResult(_0x1e7a2b,null))[_0x188f('0x41')](handleError(_0x1e7a2b,null));};exports[_0x188f('0x1f')]=function(_0x58ab26,_0xd7d2d7){return db['Template']['find']({'where':{'id':_0x58ab26[_0x188f('0x49')]['id']}})[_0x188f('0x20')](handleEntityNotFound(_0xd7d2d7,null))[_0x188f('0x20')](removeEntity(_0xd7d2d7,null))[_0x188f('0x41')](handleError(_0xd7d2d7,null));};
\ No newline at end of file
+var _0x7077=['set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','Template','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x7077,0x8b));var _0x7707=function(_0x59900a,_0x510eb7){_0x59900a=_0x59900a-0x0;var _0x3e9a2d=_0x7077[_0x59900a];return _0x3e9a2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7707('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7707('0x1'));var rp=require('request-promise');var moment=require(_0x7707('0x2'));var BPromise=require(_0x7707('0x3'));var Mustache=require(_0x7707('0x4'));var util=require(_0x7707('0x5'));var path=require(_0x7707('0x6'));var sox=require(_0x7707('0x7'));var csv=require(_0x7707('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7707('0x9'));var _=require(_0x7707('0xa'));var squel=require(_0x7707('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7707('0xc'));var toCsv=require(_0x7707('0x8'));var querystring=require(_0x7707('0xd'));var Papa=require(_0x7707('0xe'));var Redis=require(_0x7707('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7707('0x10'));var as=require(_0x7707('0x11'));var hardwareService=require(_0x7707('0x12'));var logger=require(_0x7707('0x13'))(_0x7707('0x14'));var utils=require('../../config/utils');var config=require(_0x7707('0x15'));var licenseUtil=require(_0x7707('0x16'));var db=require(_0x7707('0x17'))['db'];function respondWithStatusCode(_0x56f212,_0x3bd915){_0x3bd915=_0x3bd915||0xcc;return function(_0x5dc637){if(_0x5dc637){return _0x56f212[_0x7707('0x18')](_0x3bd915);}return _0x56f212[_0x7707('0x19')](_0x3bd915)[_0x7707('0x1a')]();};}function respondWithResult(_0x22a5b6,_0x1b83fe){_0x1b83fe=_0x1b83fe||0xc8;return function(_0x1e5d48){if(_0x1e5d48){return _0x22a5b6[_0x7707('0x19')](_0x1b83fe)['json'](_0x1e5d48);}};}function respondWithFilteredResult(_0x280ba8,_0x5ab249){return function(_0x2dc65a){if(_0x2dc65a){var _0x5a7927=typeof _0x5ab249[_0x7707('0x1b')]==='undefined'&&typeof _0x5ab249['limit']===_0x7707('0x1c');var _0x2c4fff=_0x2dc65a[_0x7707('0x1d')];var _0xeb780d=_0x5a7927?0x0:_0x5ab249[_0x7707('0x1b')];var _0x2b2dd3=_0x5a7927?_0x2dc65a['count']:_0x5ab249[_0x7707('0x1b')]+_0x5ab249[_0x7707('0x1e')];var _0xbea262;if(_0x2b2dd3>=_0x2c4fff){_0x2b2dd3=_0x2c4fff;_0xbea262=0xc8;}else{_0xbea262=0xce;}_0x280ba8['status'](_0xbea262);return _0x280ba8[_0x7707('0x1f')](_0x7707('0x20'),_0xeb780d+'-'+_0x2b2dd3+'/'+_0x2c4fff)[_0x7707('0x21')](_0x2dc65a);}return null;};}function patchUpdates(_0x42ee28){return function(_0x9f1e30){try{jsonpatch[_0x7707('0x22')](_0x9f1e30,_0x42ee28,!![]);}catch(_0x5bf8ea){return BPromise[_0x7707('0x23')](_0x5bf8ea);}return _0x9f1e30[_0x7707('0x24')]();};}function saveUpdates(_0x99189c,_0x378a3c){return function(_0x3d61be){if(_0x3d61be){return _0x3d61be[_0x7707('0x25')](_0x99189c)[_0x7707('0x26')](function(_0x1e15a1){return _0x1e15a1;});}return null;};}function removeEntity(_0x1c3a8c,_0x3969ed){return function(_0x597fc0){if(_0x597fc0){return _0x597fc0[_0x7707('0x27')]()['then'](function(){var _0x32697f=_0x597fc0[_0x7707('0x28')]({'plain':!![]});var _0x502359='Templates';return db[_0x7707('0x29')][_0x7707('0x27')]({'where':{'type':_0x502359,'resourceId':_0x32697f['id']}})[_0x7707('0x26')](function(){return _0x597fc0;});})[_0x7707('0x26')](function(){_0x1c3a8c['status'](0xcc)[_0x7707('0x1a')]();});}};}function handleEntityNotFound(_0x22a11e,_0x185547){return function(_0xfa0839){if(!_0xfa0839){_0x22a11e[_0x7707('0x18')](0x194);}return _0xfa0839;};}function handleError(_0x2d9789,_0x1cc905){_0x1cc905=_0x1cc905||0x1f4;return function(_0x4adef7){logger[_0x7707('0x2a')](_0x4adef7['stack']);if(_0x4adef7[_0x7707('0x2b')]){delete _0x4adef7['name'];}_0x2d9789[_0x7707('0x19')](_0x1cc905)['send'](_0x4adef7);};}exports[_0x7707('0x2c')]=function(_0x9bfbb1,_0x47dc65){var _0x16b975={},_0x19bb21={},_0x47e766={'count':0x0,'rows':[]};var _0x4224ac=_[_0x7707('0x2d')](db[_0x7707('0x2e')][_0x7707('0x2f')],function(_0x582e09){return{'name':_0x582e09[_0x7707('0x30')],'type':_0x582e09[_0x7707('0x31')]['key']};});_0x19bb21['model']=_[_0x7707('0x2d')](_0x4224ac,'name');_0x19bb21[_0x7707('0x32')]=_[_0x7707('0x33')](_0x9bfbb1[_0x7707('0x32')]);_0x19bb21[_0x7707('0x34')]=_[_0x7707('0x35')](_0x19bb21[_0x7707('0x36')],_0x19bb21[_0x7707('0x32')]);_0x16b975[_0x7707('0x37')]=_['intersection'](_0x19bb21['model'],qs['fields'](_0x9bfbb1[_0x7707('0x32')][_0x7707('0x38')]));_0x16b975['attributes']=_0x16b975['attributes']['length']?_0x16b975[_0x7707('0x37')]:_0x19bb21[_0x7707('0x36')];if(!_0x9bfbb1[_0x7707('0x32')][_0x7707('0x39')](_0x7707('0x3a'))){_0x16b975[_0x7707('0x1e')]=qs[_0x7707('0x1e')](_0x9bfbb1[_0x7707('0x32')][_0x7707('0x1e')]);_0x16b975[_0x7707('0x1b')]=qs[_0x7707('0x1b')](_0x9bfbb1[_0x7707('0x32')][_0x7707('0x1b')]);}_0x16b975[_0x7707('0x3b')]=qs['sort'](_0x9bfbb1[_0x7707('0x32')][_0x7707('0x3c')]);_0x16b975[_0x7707('0x3d')]=qs['filters'](_[_0x7707('0x3e')](_0x9bfbb1[_0x7707('0x32')],_0x19bb21['filters']),_0x4224ac);if(_0x9bfbb1[_0x7707('0x32')][_0x7707('0x3f')]){_0x16b975['where']=_[_0x7707('0x40')](_0x16b975[_0x7707('0x3d')],{'$or':_[_0x7707('0x2d')](_0x4224ac,function(_0x29839b){if(_0x29839b['type']!==_0x7707('0x41')){var _0x37ec70={};_0x37ec70[_0x29839b[_0x7707('0x2b')]]={'$like':'%'+_0x9bfbb1['query']['filter']+'%'};return _0x37ec70;}})});}_0x16b975=_['merge']({},_0x16b975,_0x9bfbb1['options']);var _0x5db582={'where':_0x16b975[_0x7707('0x3d')]};return db['Template'][_0x7707('0x1d')](_0x5db582)[_0x7707('0x26')](function(_0x184f88){_0x47e766[_0x7707('0x1d')]=_0x184f88;if(_0x9bfbb1['query'][_0x7707('0x42')]){_0x16b975[_0x7707('0x43')]=[{'all':!![]}];}return db[_0x7707('0x2e')][_0x7707('0x44')](_0x16b975);})[_0x7707('0x26')](function(_0x1ab90a){_0x47e766[_0x7707('0x45')]=_0x1ab90a;return _0x47e766;})[_0x7707('0x26')](respondWithFilteredResult(_0x47dc65,_0x16b975))[_0x7707('0x46')](handleError(_0x47dc65,null));};exports[_0x7707('0x47')]=function(_0x1c3a80,_0x370f5f){var _0x2e2bdd={'raw':!![],'where':{'id':_0x1c3a80['params']['id']}},_0x428dd3={};_0x428dd3['model']=_['keys'](db[_0x7707('0x2e')][_0x7707('0x2f')]);_0x428dd3[_0x7707('0x32')]=_[_0x7707('0x33')](_0x1c3a80[_0x7707('0x32')]);_0x428dd3[_0x7707('0x34')]=_['intersection'](_0x428dd3[_0x7707('0x36')],_0x428dd3['query']);_0x2e2bdd[_0x7707('0x37')]=_[_0x7707('0x35')](_0x428dd3[_0x7707('0x36')],qs[_0x7707('0x38')](_0x1c3a80[_0x7707('0x32')]['fields']));_0x2e2bdd[_0x7707('0x37')]=_0x2e2bdd[_0x7707('0x37')][_0x7707('0x48')]?_0x2e2bdd['attributes']:_0x428dd3[_0x7707('0x36')];if(_0x1c3a80[_0x7707('0x32')]['includeAll']){_0x2e2bdd[_0x7707('0x43')]=[{'all':!![]}];}_0x2e2bdd=_[_0x7707('0x40')]({},_0x2e2bdd,_0x1c3a80['options']);return db[_0x7707('0x2e')]['find'](_0x2e2bdd)[_0x7707('0x26')](handleEntityNotFound(_0x370f5f,null))[_0x7707('0x26')](respondWithResult(_0x370f5f,null))['catch'](handleError(_0x370f5f,null));};exports[_0x7707('0x49')]=function(_0x2b82b5,_0x574691){return db[_0x7707('0x2e')][_0x7707('0x49')](_0x2b82b5[_0x7707('0x4a')],{})[_0x7707('0x26')](function(_0x292b8f){var _0x4bba52=_0x2b82b5[_0x7707('0x4b')][_0x7707('0x28')]({'plain':!![]});if(!_0x4bba52)throw new Error(_0x7707('0x4c'));if(_0x4bba52[_0x7707('0x4d')]===_0x7707('0x4b')){var _0x3cadd1=_0x292b8f[_0x7707('0x28')]({'plain':!![]});var _0x1cf9a1=_0x7707('0x4e');return db[_0x7707('0x4f')][_0x7707('0x50')]({'where':{'name':_0x1cf9a1,'userProfileId':_0x4bba52[_0x7707('0x51')]},'raw':!![]})['then'](function(_0x2a7888){if(_0x2a7888&&_0x2a7888[_0x7707('0x52')]===0x0){return db[_0x7707('0x29')][_0x7707('0x49')]({'name':_0x3cadd1['name'],'resourceId':_0x3cadd1['id'],'type':_0x2a7888[_0x7707('0x2b')],'sectionId':_0x2a7888['id']},{})['then'](function(){return _0x292b8f;});}else{return _0x292b8f;}})[_0x7707('0x46')](function(_0x3da220){logger['error'](_0x7707('0x53'),_0x3da220);throw _0x3da220;});}return _0x292b8f;})[_0x7707('0x26')](respondWithResult(_0x574691,0xc9))[_0x7707('0x46')](handleError(_0x574691,null));};exports[_0x7707('0x25')]=function(_0x321160,_0x7b31ad){if(_0x321160[_0x7707('0x4a')]['id']){delete _0x321160[_0x7707('0x4a')]['id'];}return db['Template'][_0x7707('0x50')]({'where':{'id':_0x321160[_0x7707('0x54')]['id']}})[_0x7707('0x26')](handleEntityNotFound(_0x7b31ad,null))[_0x7707('0x26')](saveUpdates(_0x321160[_0x7707('0x4a')],null))[_0x7707('0x26')](respondWithResult(_0x7b31ad,null))[_0x7707('0x46')](handleError(_0x7b31ad,null));};exports[_0x7707('0x27')]=function(_0x9cdf9d,_0x38d760){return db['Template']['find']({'where':{'id':_0x9cdf9d['params']['id']}})['then'](handleEntityNotFound(_0x38d760,null))[_0x7707('0x26')](removeEntity(_0x38d760,null))['catch'](handleError(_0x38d760,null));};
\ No newline at end of file