Built motion from commit 97153652.|2.6.26
[motion2.git] / server / api / cmHopperAdditionalPhone / cmHopperAdditionalPhone.controller.js
index 0b478a3..44e8197 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa928=['rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','CmHopperAdditionalPhone','includeAll','include','findAll','rows','catch','show','params'];(function(_0x6bdd39,_0x47f066){var _0x31a7f7=function(_0x7c670c){while(--_0x7c670c){_0x6bdd39['push'](_0x6bdd39['shift']());}};_0x31a7f7(++_0x47f066);}(_0xa928,0xff));var _0x8a92=function(_0xc85589,_0x28ad4f){_0xc85589=_0xc85589-0x0;var _0x1cd5e9=_0xa928[_0xc85589];return _0x1cd5e9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8a92('0x0'));var jsonpatch=require(_0x8a92('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8a92('0x2'));var Mustache=require(_0x8a92('0x3'));var util=require('util');var path=require('path');var sox=require(_0x8a92('0x4'));var csv=require(_0x8a92('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a92('0x6'));var squel=require(_0x8a92('0x7'));var crypto=require('crypto');var jsforce=require(_0x8a92('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8a92('0x9'));var Papa=require('papaparse');var Redis=require(_0x8a92('0xa'));var authService=require(_0x8a92('0xb'));var qs=require(_0x8a92('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a92('0xd'));var logger=require(_0x8a92('0xe'))(_0x8a92('0xf'));var utils=require(_0x8a92('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x8a92('0x11'));var db=require(_0x8a92('0x12'))['db'];function respondWithStatusCode(_0x139ee5,_0x2d7070){_0x2d7070=_0x2d7070||0xcc;return function(_0x1c0746){if(_0x1c0746){return _0x139ee5[_0x8a92('0x13')](_0x2d7070);}return _0x139ee5[_0x8a92('0x14')](_0x2d7070)[_0x8a92('0x15')]();};}function respondWithResult(_0x32073f,_0xd3e2a1){_0xd3e2a1=_0xd3e2a1||0xc8;return function(_0x35ac88){if(_0x35ac88){return _0x32073f[_0x8a92('0x14')](_0xd3e2a1)[_0x8a92('0x16')](_0x35ac88);}};}function respondWithFilteredResult(_0x1edba1,_0x5c3ebb){return function(_0x5a0c4f){if(_0x5a0c4f){var _0x145b47=typeof _0x5c3ebb[_0x8a92('0x17')]===_0x8a92('0x18')&&typeof _0x5c3ebb['limit']==='undefined';var _0x151734=_0x5a0c4f[_0x8a92('0x19')];var _0x25e6bb=_0x145b47?0x0:_0x5c3ebb[_0x8a92('0x17')];var _0x2d5809=_0x145b47?_0x5a0c4f[_0x8a92('0x19')]:_0x5c3ebb['offset']+_0x5c3ebb['limit'];var _0x4365a9;if(_0x2d5809>=_0x151734){_0x2d5809=_0x151734;_0x4365a9=0xc8;}else{_0x4365a9=0xce;}_0x1edba1['status'](_0x4365a9);return _0x1edba1['set'](_0x8a92('0x1a'),_0x25e6bb+'-'+_0x2d5809+'/'+_0x151734)[_0x8a92('0x16')](_0x5a0c4f);}return null;};}function patchUpdates(_0xd01324){return function(_0x4c7c9a){try{jsonpatch[_0x8a92('0x1b')](_0x4c7c9a,_0xd01324,!![]);}catch(_0x57daa1){return BPromise[_0x8a92('0x1c')](_0x57daa1);}return _0x4c7c9a[_0x8a92('0x1d')]();};}function saveUpdates(_0x129d0f,_0x3aca14){return function(_0xf2ac6c){if(_0xf2ac6c){return _0xf2ac6c[_0x8a92('0x1e')](_0x129d0f)[_0x8a92('0x1f')](function(_0x1c9545){return _0x1c9545;});}return null;};}function removeEntity(_0x404de7,_0x3fbe22){return function(_0x3180fb){if(_0x3180fb){return _0x3180fb[_0x8a92('0x20')]()[_0x8a92('0x1f')](function(){var _0x464e7e=_0x3180fb[_0x8a92('0x21')]({'plain':!![]});var _0x5ee1c9='CmHopperAdditionalPhones';return db[_0x8a92('0x22')][_0x8a92('0x20')]({'where':{'type':_0x5ee1c9,'resourceId':_0x464e7e['id']}})['then'](function(){return _0x3180fb;});})[_0x8a92('0x1f')](function(){_0x404de7[_0x8a92('0x14')](0xcc)[_0x8a92('0x15')]();});}};}function handleEntityNotFound(_0x5461af,_0x487d46){return function(_0x498493){if(!_0x498493){_0x5461af[_0x8a92('0x13')](0x194);}return _0x498493;};}function handleError(_0xcd98fa,_0x3ff18a){_0x3ff18a=_0x3ff18a||0x1f4;return function(_0x2b26df){logger[_0x8a92('0x23')](_0x2b26df['stack']);if(_0x2b26df[_0x8a92('0x24')]){delete _0x2b26df[_0x8a92('0x24')];}_0xcd98fa[_0x8a92('0x14')](_0x3ff18a)[_0x8a92('0x25')](_0x2b26df);};}exports['index']=function(_0x274a5b,_0x4e2442){var _0x3f825a={},_0x33f71e={},_0x2f400e={'count':0x0,'rows':[]};var _0x20f638=_[_0x8a92('0x26')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x531842){return{'name':_0x531842[_0x8a92('0x27')],'type':_0x531842[_0x8a92('0x28')][_0x8a92('0x29')]};});_0x33f71e[_0x8a92('0x2a')]=_['map'](_0x20f638,'name');_0x33f71e[_0x8a92('0x2b')]=_[_0x8a92('0x2c')](_0x274a5b[_0x8a92('0x2b')]);_0x33f71e['filters']=_[_0x8a92('0x2d')](_0x33f71e[_0x8a92('0x2a')],_0x33f71e[_0x8a92('0x2b')]);_0x3f825a[_0x8a92('0x2e')]=_[_0x8a92('0x2d')](_0x33f71e['model'],qs[_0x8a92('0x2f')](_0x274a5b[_0x8a92('0x2b')][_0x8a92('0x2f')]));_0x3f825a[_0x8a92('0x2e')]=_0x3f825a[_0x8a92('0x2e')][_0x8a92('0x30')]?_0x3f825a['attributes']:_0x33f71e[_0x8a92('0x2a')];if(!_0x274a5b[_0x8a92('0x2b')][_0x8a92('0x31')](_0x8a92('0x32'))){_0x3f825a[_0x8a92('0x33')]=qs['limit'](_0x274a5b['query'][_0x8a92('0x33')]);_0x3f825a[_0x8a92('0x17')]=qs['offset'](_0x274a5b[_0x8a92('0x2b')]['offset']);}_0x3f825a[_0x8a92('0x34')]=qs[_0x8a92('0x35')](_0x274a5b[_0x8a92('0x2b')][_0x8a92('0x35')]);_0x3f825a['where']=qs[_0x8a92('0x36')](_[_0x8a92('0x37')](_0x274a5b['query'],_0x33f71e[_0x8a92('0x36')]),_0x20f638);if(_0x274a5b['query'][_0x8a92('0x38')]){_0x3f825a[_0x8a92('0x39')]=_[_0x8a92('0x3a')](_0x3f825a[_0x8a92('0x39')],{'$or':_['map'](_0x20f638,function(_0xcc6455){if(_0xcc6455[_0x8a92('0x28')]!==_0x8a92('0x3b')){var _0x23dfc1={};_0x23dfc1[_0xcc6455[_0x8a92('0x24')]]={'$like':'%'+_0x274a5b[_0x8a92('0x2b')]['filter']+'%'};return _0x23dfc1;}})});}_0x3f825a=_[_0x8a92('0x3a')]({},_0x3f825a,_0x274a5b[_0x8a92('0x3c')]);var _0x31a056={'where':_0x3f825a[_0x8a92('0x39')]};return db[_0x8a92('0x3d')][_0x8a92('0x19')](_0x31a056)[_0x8a92('0x1f')](function(_0xf3eba1){_0x2f400e['count']=_0xf3eba1;if(_0x274a5b[_0x8a92('0x2b')][_0x8a92('0x3e')]){_0x3f825a[_0x8a92('0x3f')]=[{'all':!![]}];}return db[_0x8a92('0x3d')][_0x8a92('0x40')](_0x3f825a);})[_0x8a92('0x1f')](function(_0x3cd893){_0x2f400e[_0x8a92('0x41')]=_0x3cd893;return _0x2f400e;})[_0x8a92('0x1f')](respondWithFilteredResult(_0x4e2442,_0x3f825a))[_0x8a92('0x42')](handleError(_0x4e2442,null));};exports[_0x8a92('0x43')]=function(_0x294d4e,_0xfef743){var _0x2cf493={'raw':!![],'where':{'id':_0x294d4e[_0x8a92('0x44')]['id']}},_0x36d4e6={};_0x36d4e6[_0x8a92('0x2a')]=_[_0x8a92('0x2c')](db['CmHopperAdditionalPhone'][_0x8a92('0x45')]);_0x36d4e6[_0x8a92('0x2b')]=_[_0x8a92('0x2c')](_0x294d4e['query']);_0x36d4e6[_0x8a92('0x36')]=_[_0x8a92('0x2d')](_0x36d4e6['model'],_0x36d4e6[_0x8a92('0x2b')]);_0x2cf493[_0x8a92('0x2e')]=_[_0x8a92('0x2d')](_0x36d4e6['model'],qs[_0x8a92('0x2f')](_0x294d4e[_0x8a92('0x2b')][_0x8a92('0x2f')]));_0x2cf493[_0x8a92('0x2e')]=_0x2cf493[_0x8a92('0x2e')][_0x8a92('0x30')]?_0x2cf493['attributes']:_0x36d4e6['model'];if(_0x294d4e[_0x8a92('0x2b')][_0x8a92('0x3e')]){_0x2cf493[_0x8a92('0x3f')]=[{'all':!![]}];}_0x2cf493=_[_0x8a92('0x3a')]({},_0x2cf493,_0x294d4e[_0x8a92('0x3c')]);return db[_0x8a92('0x3d')][_0x8a92('0x46')](_0x2cf493)[_0x8a92('0x1f')](handleEntityNotFound(_0xfef743,null))[_0x8a92('0x1f')](respondWithResult(_0xfef743,null))['catch'](handleError(_0xfef743,null));};exports[_0x8a92('0x47')]=function(_0x5bcf00,_0x2aa3d7){return db[_0x8a92('0x3d')][_0x8a92('0x47')](_0x5bcf00[_0x8a92('0x48')],{})[_0x8a92('0x1f')](function(_0xa9b7f8){var _0x2bb8e1=_0x5bcf00[_0x8a92('0x49')][_0x8a92('0x21')]({'plain':!![]});if(!_0x2bb8e1)throw new Error(_0x8a92('0x4a'));if(_0x2bb8e1[_0x8a92('0x4b')]===_0x8a92('0x49')){var _0x5c2d3b=_0xa9b7f8[_0x8a92('0x21')]({'plain':!![]});var _0x449d15=_0x8a92('0x4c');return db[_0x8a92('0x4d')][_0x8a92('0x46')]({'where':{'name':_0x449d15,'userProfileId':_0x2bb8e1[_0x8a92('0x4e')]},'raw':!![]})[_0x8a92('0x1f')](function(_0x2a01b5){if(_0x2a01b5&&_0x2a01b5[_0x8a92('0x4f')]===0x0){return db[_0x8a92('0x22')][_0x8a92('0x47')]({'name':_0x5c2d3b[_0x8a92('0x24')],'resourceId':_0x5c2d3b['id'],'type':_0x2a01b5[_0x8a92('0x24')],'sectionId':_0x2a01b5['id']},{})[_0x8a92('0x1f')](function(){return _0xa9b7f8;});}else{return _0xa9b7f8;}})[_0x8a92('0x42')](function(_0xa77047){logger[_0x8a92('0x23')](_0x8a92('0x50'),_0xa77047);throw _0xa77047;});}return _0xa9b7f8;})['then'](respondWithResult(_0x2aa3d7,0xc9))['catch'](handleError(_0x2aa3d7,null));};exports['update']=function(_0x2443a6,_0x29f5ad){if(_0x2443a6[_0x8a92('0x48')]['id']){delete _0x2443a6[_0x8a92('0x48')]['id'];}return db[_0x8a92('0x3d')][_0x8a92('0x46')]({'where':{'id':_0x2443a6[_0x8a92('0x44')]['id']}})['then'](handleEntityNotFound(_0x29f5ad,null))[_0x8a92('0x1f')](saveUpdates(_0x2443a6[_0x8a92('0x48')],null))[_0x8a92('0x1f')](respondWithResult(_0x29f5ad,null))[_0x8a92('0x42')](handleError(_0x29f5ad,null));};exports[_0x8a92('0x20')]=function(_0x4cead1,_0xd0f180){return db[_0x8a92('0x3d')][_0x8a92('0x46')]({'where':{'id':_0x4cead1[_0x8a92('0x44')]['id']}})[_0x8a92('0x1f')](handleEntityNotFound(_0xd0f180,null))['then'](removeEntity(_0xd0f180,null))[_0x8a92('0x42')](handleError(_0xd0f180,null));};
\ No newline at end of file
+var _0x6ff6=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','get','CmHopperAdditionalPhones','error','name','send','index','CmHopperAdditionalPhone','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','include','catch','show','params','rawAttributes','fields','includeAll','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse'];(function(_0xa1e3ca,_0x559022){var _0x5005ab=function(_0x12f90e){while(--_0x12f90e){_0xa1e3ca['push'](_0xa1e3ca['shift']());}};_0x5005ab(++_0x559022);}(_0x6ff6,0xdd));var _0x66ff=function(_0x2a3f2b,_0x2113a8){_0x2a3f2b=_0x2a3f2b-0x0;var _0x40675e=_0x6ff6[_0x2a3f2b];return _0x40675e;};'use strict';var emlformat=require(_0x66ff('0x0'));var rimraf=require(_0x66ff('0x1'));var zipdir=require(_0x66ff('0x2'));var jsonpatch=require(_0x66ff('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x66ff('0x4'));var Mustache=require(_0x66ff('0x5'));var util=require(_0x66ff('0x6'));var path=require(_0x66ff('0x7'));var sox=require('sox');var csv=require(_0x66ff('0x8'));var ejs=require(_0x66ff('0x9'));var fs=require('fs');var fs_extra=require(_0x66ff('0xa'));var _=require(_0x66ff('0xb'));var squel=require(_0x66ff('0xc'));var crypto=require(_0x66ff('0xd'));var jsforce=require(_0x66ff('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x66ff('0x8'));var querystring=require('querystring');var Papa=require(_0x66ff('0xf'));var Redis=require(_0x66ff('0x10'));var authService=require(_0x66ff('0x11'));var qs=require(_0x66ff('0x12'));var as=require(_0x66ff('0x13'));var hardwareService=require(_0x66ff('0x14'));var logger=require(_0x66ff('0x15'))('api');var utils=require(_0x66ff('0x16'));var config=require(_0x66ff('0x17'));var licenseUtil=require(_0x66ff('0x18'));var db=require(_0x66ff('0x19'))['db'];function respondWithStatusCode(_0xf616eb,_0x2ba441){_0x2ba441=_0x2ba441||0xcc;return function(_0x10c99d){if(_0x10c99d){return _0xf616eb['sendStatus'](_0x2ba441);}return _0xf616eb[_0x66ff('0x1a')](_0x2ba441)[_0x66ff('0x1b')]();};}function respondWithResult(_0x247375,_0x561a06){_0x561a06=_0x561a06||0xc8;return function(_0x450e6a){if(_0x450e6a){return _0x247375['status'](_0x561a06)[_0x66ff('0x1c')](_0x450e6a);}};}function respondWithFilteredResult(_0x2b1ead,_0x35295a){return function(_0x4523b7){if(_0x4523b7){var _0x4d03ab=typeof _0x35295a[_0x66ff('0x1d')]===_0x66ff('0x1e')&&typeof _0x35295a[_0x66ff('0x1f')]==='undefined';var _0x5da13e=_0x4523b7['count'];var _0x57ad21=_0x4d03ab?0x0:_0x35295a[_0x66ff('0x1d')];var _0x1c77b3=_0x4d03ab?_0x4523b7[_0x66ff('0x20')]:_0x35295a[_0x66ff('0x1d')]+_0x35295a[_0x66ff('0x1f')];var _0x376523;if(_0x1c77b3>=_0x5da13e){_0x1c77b3=_0x5da13e;_0x376523=0xc8;}else{_0x376523=0xce;}_0x2b1ead[_0x66ff('0x1a')](_0x376523);return _0x2b1ead['set']('Content-Range',_0x57ad21+'-'+_0x1c77b3+'/'+_0x5da13e)[_0x66ff('0x1c')](_0x4523b7);}return null;};}function patchUpdates(_0x1257a0){return function(_0x3e7823){try{jsonpatch[_0x66ff('0x21')](_0x3e7823,_0x1257a0,!![]);}catch(_0x460eef){return BPromise[_0x66ff('0x22')](_0x460eef);}return _0x3e7823['save']();};}function saveUpdates(_0x47dc14,_0x5bc1b9){return function(_0x56c288){if(_0x56c288){return _0x56c288[_0x66ff('0x23')](_0x47dc14)[_0x66ff('0x24')](function(_0x1118bd){return _0x1118bd;});}return null;};}function removeEntity(_0x29a002,_0x2566a6){return function(_0x7d2d2f){if(_0x7d2d2f){return _0x7d2d2f[_0x66ff('0x25')]()[_0x66ff('0x24')](function(){var _0x40c360=_0x7d2d2f[_0x66ff('0x26')]({'plain':!![]});var _0x17d519=_0x66ff('0x27');return db['UserProfileResource'][_0x66ff('0x25')]({'where':{'type':_0x17d519,'resourceId':_0x40c360['id']}})[_0x66ff('0x24')](function(){return _0x7d2d2f;});})['then'](function(){_0x29a002[_0x66ff('0x1a')](0xcc)[_0x66ff('0x1b')]();});}};}function handleEntityNotFound(_0x43a0e9,_0x546ee0){return function(_0x37b7ff){if(!_0x37b7ff){_0x43a0e9['sendStatus'](0x194);}return _0x37b7ff;};}function handleError(_0x1aad72,_0x3bed0d){_0x3bed0d=_0x3bed0d||0x1f4;return function(_0x4fa394){logger[_0x66ff('0x28')](_0x4fa394['stack']);if(_0x4fa394[_0x66ff('0x29')]){delete _0x4fa394['name'];}_0x1aad72['status'](_0x3bed0d)[_0x66ff('0x2a')](_0x4fa394);};}exports[_0x66ff('0x2b')]=function(_0x219e08,_0x581dd9){var _0x824249={},_0x4b2645={},_0x55e9a2={'count':0x0,'rows':[]};var _0x4c8f63=_['map'](db[_0x66ff('0x2c')]['rawAttributes'],function(_0x554c1e){return{'name':_0x554c1e[_0x66ff('0x2d')],'type':_0x554c1e[_0x66ff('0x2e')]['key']};});_0x4b2645[_0x66ff('0x2f')]=_[_0x66ff('0x30')](_0x4c8f63,_0x66ff('0x29'));_0x4b2645[_0x66ff('0x31')]=_[_0x66ff('0x32')](_0x219e08['query']);_0x4b2645[_0x66ff('0x33')]=_[_0x66ff('0x34')](_0x4b2645[_0x66ff('0x2f')],_0x4b2645[_0x66ff('0x31')]);_0x824249[_0x66ff('0x35')]=_[_0x66ff('0x34')](_0x4b2645[_0x66ff('0x2f')],qs['fields'](_0x219e08[_0x66ff('0x31')]['fields']));_0x824249['attributes']=_0x824249[_0x66ff('0x35')][_0x66ff('0x36')]?_0x824249[_0x66ff('0x35')]:_0x4b2645[_0x66ff('0x2f')];if(!_0x219e08[_0x66ff('0x31')][_0x66ff('0x37')](_0x66ff('0x38'))){_0x824249[_0x66ff('0x1f')]=qs[_0x66ff('0x1f')](_0x219e08[_0x66ff('0x31')][_0x66ff('0x1f')]);_0x824249[_0x66ff('0x1d')]=qs['offset'](_0x219e08[_0x66ff('0x31')][_0x66ff('0x1d')]);}_0x824249['order']=qs['sort'](_0x219e08['query'][_0x66ff('0x39')]);_0x824249[_0x66ff('0x3a')]=qs['filters'](_[_0x66ff('0x3b')](_0x219e08['query'],_0x4b2645['filters']),_0x4c8f63);if(_0x219e08[_0x66ff('0x31')]['filter']){_0x824249[_0x66ff('0x3a')]=_[_0x66ff('0x3c')](_0x824249[_0x66ff('0x3a')],{'$or':_[_0x66ff('0x30')](_0x4c8f63,function(_0x32ce8c){if(_0x32ce8c[_0x66ff('0x2e')]!=='VIRTUAL'){var _0x2d798a={};_0x2d798a[_0x32ce8c[_0x66ff('0x29')]]={'$like':'%'+_0x219e08[_0x66ff('0x31')][_0x66ff('0x3d')]+'%'};return _0x2d798a;}})});}_0x824249=_[_0x66ff('0x3c')]({},_0x824249,_0x219e08['options']);var _0x16236c={'where':_0x824249[_0x66ff('0x3a')]};return db['CmHopperAdditionalPhone']['count'](_0x16236c)[_0x66ff('0x24')](function(_0x3bf0c2){_0x55e9a2[_0x66ff('0x20')]=_0x3bf0c2;if(_0x219e08[_0x66ff('0x31')]['includeAll']){_0x824249[_0x66ff('0x3e')]=[{'all':!![]}];}return db[_0x66ff('0x2c')]['findAll'](_0x824249);})[_0x66ff('0x24')](function(_0x43454a){_0x55e9a2['rows']=_0x43454a;return _0x55e9a2;})['then'](respondWithFilteredResult(_0x581dd9,_0x824249))[_0x66ff('0x3f')](handleError(_0x581dd9,null));};exports[_0x66ff('0x40')]=function(_0x18c26d,_0x3f8737){var _0x3660c8={'raw':!![],'where':{'id':_0x18c26d[_0x66ff('0x41')]['id']}},_0x2105c4={};_0x2105c4['model']=_[_0x66ff('0x32')](db[_0x66ff('0x2c')][_0x66ff('0x42')]);_0x2105c4['query']=_[_0x66ff('0x32')](_0x18c26d[_0x66ff('0x31')]);_0x2105c4[_0x66ff('0x33')]=_[_0x66ff('0x34')](_0x2105c4['model'],_0x2105c4[_0x66ff('0x31')]);_0x3660c8['attributes']=_[_0x66ff('0x34')](_0x2105c4[_0x66ff('0x2f')],qs[_0x66ff('0x43')](_0x18c26d[_0x66ff('0x31')]['fields']));_0x3660c8[_0x66ff('0x35')]=_0x3660c8[_0x66ff('0x35')]['length']?_0x3660c8[_0x66ff('0x35')]:_0x2105c4[_0x66ff('0x2f')];if(_0x18c26d[_0x66ff('0x31')][_0x66ff('0x44')]){_0x3660c8[_0x66ff('0x3e')]=[{'all':!![]}];}_0x3660c8=_[_0x66ff('0x3c')]({},_0x3660c8,_0x18c26d[_0x66ff('0x45')]);return db['CmHopperAdditionalPhone'][_0x66ff('0x46')](_0x3660c8)['then'](handleEntityNotFound(_0x3f8737,null))[_0x66ff('0x24')](respondWithResult(_0x3f8737,null))[_0x66ff('0x3f')](handleError(_0x3f8737,null));};exports[_0x66ff('0x47')]=function(_0x2e2aef,_0x4813e2){return db['CmHopperAdditionalPhone']['create'](_0x2e2aef[_0x66ff('0x48')],{})['then'](function(_0x1e2dfb){var _0x369d7c=_0x2e2aef[_0x66ff('0x49')][_0x66ff('0x26')]({'plain':!![]});if(!_0x369d7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x369d7c[_0x66ff('0x4a')]===_0x66ff('0x49')){var _0xab5e4a=_0x1e2dfb[_0x66ff('0x26')]({'plain':!![]});var _0x5469e1=_0x66ff('0x27');return db[_0x66ff('0x4b')][_0x66ff('0x46')]({'where':{'name':_0x5469e1,'userProfileId':_0x369d7c[_0x66ff('0x4c')]},'raw':!![]})[_0x66ff('0x24')](function(_0x4aa9df){if(_0x4aa9df&&_0x4aa9df[_0x66ff('0x4d')]===0x0){return db[_0x66ff('0x4e')]['create']({'name':_0xab5e4a[_0x66ff('0x29')],'resourceId':_0xab5e4a['id'],'type':_0x4aa9df[_0x66ff('0x29')],'sectionId':_0x4aa9df['id']},{})[_0x66ff('0x24')](function(){return _0x1e2dfb;});}else{return _0x1e2dfb;}})[_0x66ff('0x3f')](function(_0x3982d4){logger[_0x66ff('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3982d4);throw _0x3982d4;});}return _0x1e2dfb;})[_0x66ff('0x24')](respondWithResult(_0x4813e2,0xc9))[_0x66ff('0x3f')](handleError(_0x4813e2,null));};exports[_0x66ff('0x23')]=function(_0x62b45d,_0x2f7cec){if(_0x62b45d[_0x66ff('0x48')]['id']){delete _0x62b45d[_0x66ff('0x48')]['id'];}return db[_0x66ff('0x2c')][_0x66ff('0x46')]({'where':{'id':_0x62b45d[_0x66ff('0x41')]['id']}})[_0x66ff('0x24')](handleEntityNotFound(_0x2f7cec,null))['then'](saveUpdates(_0x62b45d[_0x66ff('0x48')],null))[_0x66ff('0x24')](respondWithResult(_0x2f7cec,null))[_0x66ff('0x3f')](handleError(_0x2f7cec,null));};exports[_0x66ff('0x25')]=function(_0x1222e0,_0x54f7cc){return db[_0x66ff('0x2c')]['find']({'where':{'id':_0x1222e0['params']['id']}})[_0x66ff('0x24')](handleEntityNotFound(_0x54f7cc,null))[_0x66ff('0x24')](removeEntity(_0x54f7cc,null))['catch'](handleError(_0x54f7cc,null));};
\ No newline at end of file