Built motion from commit a9fb64cc6defd8fb3a5cc199221f878e91c0e969. Version 3.0.0...
[motion-next.git] / server / api / cmCompany / cmCompany.controller.js
index bf6c91c..aa9ada1 100644 (file)
@@ -1 +1 @@
-const a122_0x1284=['Companies','length','api','filter','../../mysqldb','findOne','../../config/logger','filters','userProfileId','then','UserProfileSection','getContacts','include','get','destroy','where','status','json','end','UserProfileResource','sequelize','rawAttributes','catch','keys','addContacts','undefined','query','error','order','stack','name','findAll','limit','pick','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','user','map','intersection','omit','../../components/parsers/qs','create','fields','like','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','options','includeAll','offset','params','role','Content-Range','sort','merge','attributes','count','lodash','sendStatus','model','CmContact','describe','CmCompany','update','show'];(function(_0x509df6,_0x1284a5){const _0x13a2d4=function(_0x5507d8){while(--_0x5507d8){_0x509df6['push'](_0x509df6['shift']());}};_0x13a2d4(++_0x1284a5);}(a122_0x1284,0x162));const a122_0x13a2=function(_0x509df6,_0x1284a5){_0x509df6=_0x509df6-0x0;let _0x13a2d4=a122_0x1284[_0x509df6];return _0x13a2d4;};const _0x43eaee=a122_0x13a2;'use strict';const _=require(_0x43eaee('0x10')),qs=require(_0x43eaee('0x0')),logger=require(_0x43eaee('0x1e'))(_0x43eaee('0x1a')),db=require(_0x43eaee('0x1c'))['db'],{Op}=require(_0x43eaee('0x2c'));function respondWithResult(_0x5507d8,_0x9f30ac){return _0x9f30ac=_0x9f30ac||0xc8,function(_0x5e7792){const _0x2acfc9=a122_0x13a2;if(_0x5e7792)return _0x5507d8[_0x2acfc9('0x28')](_0x9f30ac)[_0x2acfc9('0x29')](_0x5e7792);};}function respondWithFilteredResult(_0x24e703,_0x4aa655){return function(_0x4ee83a){const _0x50d27b=a122_0x13a2;if(_0x4ee83a){const _0x1aba19=_0x4ee83a['count'],_0x214e38=_0x4aa655[_0x50d27b('0x8')];let _0x50a6e5=_0x4aa655[_0x50d27b('0x8')]+_0x4aa655[_0x50d27b('0x38')],_0x493e97;return _0x50a6e5>=_0x1aba19?(_0x50a6e5=_0x1aba19,_0x493e97=0xc8):_0x493e97=0xce,_0x24e703[_0x50d27b('0x28')](_0x493e97),_0x24e703['set'](_0x50d27b('0xb'),_0x214e38+'-'+_0x50a6e5+'/'+_0x1aba19)['json'](_0x4ee83a);}return null;};}function saveUpdates(_0x4ecae6){return function(_0x49aa9c){const _0x3437d4=a122_0x13a2;if(_0x49aa9c)return _0x49aa9c[_0x3437d4('0x16')](_0x4ecae6)[_0x3437d4('0x21')](function(_0x51b043){return _0x51b043;});return null;};}function removeEntity(_0x4af8ba){return function(_0xdd2a24){const _0x300eec=a122_0x13a2;if(_0xdd2a24)return _0xdd2a24[_0x300eec('0x26')]()[_0x300eec('0x21')](function(){const _0x44604d=_0x300eec,_0x5f54c3=_0xdd2a24[_0x44604d('0x25')]({'plain':!![]}),_0x1b5876=_0x44604d('0x18');return db[_0x44604d('0x2b')][_0x44604d('0x26')]({'where':{'type':_0x1b5876,'resourceId':_0x5f54c3['id']}})[_0x44604d('0x21')](function(){return _0xdd2a24;});})[_0x300eec('0x21')](function(){const _0x35910d=_0x300eec;_0x4af8ba['status'](0xcc)[_0x35910d('0x2a')]();});};}function handleEntityNotFound(_0x2982f3){return function(_0x1f0faa){const _0x1f7e89=a122_0x13a2;return!_0x1f0faa&&_0x2982f3[_0x1f7e89('0x11')](0x194),_0x1f0faa;};}function handleError(_0x405a26,_0x3f899a){return _0x3f899a=_0x3f899a||0x1f4,function(_0x47a1be){const _0x37bfee=a122_0x13a2;logger[_0x37bfee('0x33')](_0x47a1be[_0x37bfee('0x35')]),_0x47a1be[_0x37bfee('0x36')]&&delete _0x47a1be['name'],_0x405a26[_0x37bfee('0x28')](_0x3f899a)['send'](_0x47a1be);};}exports['index']=function(_0x371869,_0x19b536){const _0x3a8c95=_0x43eaee;let _0x4b9a16={};const _0x1230a9={},_0x3ae297={'count':0x0,'rows':[]};return db[_0x3a8c95('0x15')][_0x3a8c95('0x14')]()[_0x3a8c95('0x21')](function(_0x45a612){const _0x16b6c7=_0x3a8c95;_0x1230a9[_0x16b6c7('0x12')]=_[_0x16b6c7('0x2f')](_0x45a612),_0x1230a9[_0x16b6c7('0x32')]=_['keys'](_0x371869[_0x16b6c7('0x32')]),_0x1230a9[_0x16b6c7('0x1f')]=_['intersection'](_0x1230a9['model'],_0x1230a9[_0x16b6c7('0x32')]),_0x4b9a16[_0x16b6c7('0xe')]=_['intersection'](_0x1230a9[_0x16b6c7('0x12')],qs[_0x16b6c7('0x2')](_0x371869[_0x16b6c7('0x32')][_0x16b6c7('0x2')])),_0x4b9a16['attributes']=_0x4b9a16[_0x16b6c7('0xe')][_0x16b6c7('0x19')]?_0x4b9a16[_0x16b6c7('0xe')]:_0x1230a9[_0x16b6c7('0x12')];typeof _0x371869[_0x16b6c7('0x32')]['nolimit']===_0x16b6c7('0x31')&&(_0x4b9a16[_0x16b6c7('0x38')]=qs['limit'](_0x371869[_0x16b6c7('0x32')][_0x16b6c7('0x38')]),_0x4b9a16[_0x16b6c7('0x8')]=qs[_0x16b6c7('0x8')](_0x371869[_0x16b6c7('0x32')][_0x16b6c7('0x8')]));_0x4b9a16[_0x16b6c7('0x34')]=qs[_0x16b6c7('0xc')](_0x371869[_0x16b6c7('0x32')][_0x16b6c7('0xc')]),_0x4b9a16[_0x16b6c7('0x27')]=qs[_0x16b6c7('0x1f')](_['pick'](_0x371869[_0x16b6c7('0x32')],_0x1230a9['filters']),_0x45a612);_0x371869['query'][_0x16b6c7('0x1b')]&&(_0x4b9a16['where']=_[_0x16b6c7('0xd')](_0x4b9a16[_0x16b6c7('0x27')],{[Op['or']]:_[_0x16b6c7('0x3c')](_0x4b9a16[_0x16b6c7('0xe')],function(_0xed342f){const _0x24ee95=_0x16b6c7,_0x49bdfc={};return _0x49bdfc[_0xed342f]={[Op[_0x24ee95('0x3')]]:'%'+_0x371869[_0x24ee95('0x32')][_0x24ee95('0x1b')]+'%'},_0x49bdfc;})}));_0x4b9a16=_[_0x16b6c7('0xd')]({},_0x4b9a16,_0x371869[_0x16b6c7('0x6')]);const _0x304492={'where':_0x4b9a16['where']};return db[_0x16b6c7('0x15')][_0x16b6c7('0xf')](_0x304492)[_0x16b6c7('0x21')](function(_0x2f998d){const _0x446044=_0x16b6c7;return _0x3ae297[_0x446044('0xf')]=_0x2f998d,_0x371869[_0x446044('0x32')][_0x446044('0x7')]&&(_0x4b9a16[_0x446044('0x24')]=[{'all':!![]}]),db[_0x446044('0x15')][_0x446044('0x37')](_0x4b9a16);})[_0x16b6c7('0x21')](function(_0x58cf47){return _0x3ae297['rows']=_0x58cf47,_0x3ae297;})[_0x16b6c7('0x21')](respondWithFilteredResult(_0x19b536,_0x4b9a16))[_0x16b6c7('0x2e')](handleError(_0x19b536,null));})['catch'](handleError(_0x19b536,null));},exports[_0x43eaee('0x17')]=function(_0x29c56f,_0x8d6fd7){const _0x35e2bb=_0x43eaee;let _0x2628bd={'raw':![],'where':{'id':_0x29c56f[_0x35e2bb('0x9')]['id']}};const _0x260e25={};return _0x260e25[_0x35e2bb('0x12')]=_[_0x35e2bb('0x2f')](db[_0x35e2bb('0x15')][_0x35e2bb('0x2d')]),_0x260e25[_0x35e2bb('0x32')]=_['keys'](_0x29c56f[_0x35e2bb('0x32')]),_0x260e25[_0x35e2bb('0x1f')]=_[_0x35e2bb('0x3d')](_0x260e25[_0x35e2bb('0x12')],_0x260e25['query']),_0x2628bd[_0x35e2bb('0xe')]=_[_0x35e2bb('0x3d')](_0x260e25['model'],qs[_0x35e2bb('0x2')](_0x29c56f[_0x35e2bb('0x32')][_0x35e2bb('0x2')])),_0x2628bd['attributes']=_0x2628bd[_0x35e2bb('0xe')][_0x35e2bb('0x19')]?_0x2628bd['attributes']:_0x260e25[_0x35e2bb('0x12')],_0x29c56f[_0x35e2bb('0x32')][_0x35e2bb('0x7')]&&(_0x2628bd['include']=[{'all':!![]}]),_0x2628bd=_['merge']({},_0x2628bd,_0x29c56f[_0x35e2bb('0x6')]),db[_0x35e2bb('0x15')][_0x35e2bb('0x1d')](_0x2628bd)[_0x35e2bb('0x21')](handleEntityNotFound(_0x8d6fd7,null))[_0x35e2bb('0x21')](respondWithResult(_0x8d6fd7,null))['catch'](handleError(_0x8d6fd7,null));},exports['create']=function(_0x43d57e,_0x46c51f){const _0x5a8a2b=_0x43eaee;return db[_0x5a8a2b('0x15')][_0x5a8a2b('0x1')](_0x43d57e['body'],{})[_0x5a8a2b('0x21')](function(_0x228f40){const _0x4c0e74=_0x5a8a2b,_0x467708=_0x43d57e[_0x4c0e74('0x3b')][_0x4c0e74('0x25')]({'plain':!![]});if(!_0x467708)throw new Error(_0x4c0e74('0x5'));if(_0x467708[_0x4c0e74('0xa')]===_0x4c0e74('0x3b')){const _0x173601=_0x228f40[_0x4c0e74('0x25')]({'plain':!![]}),_0x32ca0b='Companies';return db[_0x4c0e74('0x22')][_0x4c0e74('0x1d')]({'where':{'name':_0x32ca0b,'userProfileId':_0x467708[_0x4c0e74('0x20')]},'raw':!![]})[_0x4c0e74('0x21')](function(_0x3d5729){const _0x1be2e5=_0x4c0e74;return _0x3d5729&&_0x3d5729['autoAssociation']===0x0?db[_0x1be2e5('0x2b')][_0x1be2e5('0x1')]({'name':_0x173601[_0x1be2e5('0x36')],'resourceId':_0x173601['id'],'type':_0x3d5729[_0x1be2e5('0x36')],'sectionId':_0x3d5729['id']},{})['then'](function(){return _0x228f40;}):_0x228f40;})[_0x4c0e74('0x2e')](function(_0x1309a5){const _0x36822d=_0x4c0e74;logger['error'](_0x36822d('0x3a'),_0x1309a5);throw _0x1309a5;});}return _0x228f40;})[_0x5a8a2b('0x21')](respondWithResult(_0x46c51f,0xc9))[_0x5a8a2b('0x2e')](handleError(_0x46c51f,null));},exports[_0x43eaee('0x16')]=function(_0x13a3ce,_0x2f3d49){const _0x5cc130=_0x43eaee;return _0x13a3ce['body']['id']&&delete _0x13a3ce[_0x5cc130('0x4')]['id'],db[_0x5cc130('0x15')][_0x5cc130('0x1d')]({'where':{'id':_0x13a3ce[_0x5cc130('0x9')]['id']}})[_0x5cc130('0x21')](handleEntityNotFound(_0x2f3d49,null))[_0x5cc130('0x21')](saveUpdates(_0x13a3ce['body'],null))['then'](respondWithResult(_0x2f3d49,null))[_0x5cc130('0x2e')](handleError(_0x2f3d49,null));},exports[_0x43eaee('0x26')]=function(_0x3b9c26,_0x485bc4){const _0x51ca78=_0x43eaee;return db[_0x51ca78('0x15')][_0x51ca78('0x1d')]({'where':{'id':_0x3b9c26['params']['id']}})['then'](handleEntityNotFound(_0x485bc4,null))[_0x51ca78('0x21')](removeEntity(_0x485bc4,null))[_0x51ca78('0x2e')](handleError(_0x485bc4,null));},exports['describe']=function(_0x51c294,_0x3335d8){const _0x53d963=_0x43eaee;return db[_0x53d963('0x15')][_0x53d963('0x14')]()[_0x53d963('0x21')](respondWithResult(_0x3335d8,null))[_0x53d963('0x2e')](handleError(_0x3335d8,null));},exports[_0x43eaee('0x30')]=function(_0x5d7ccf,_0x28168b){const _0x1a2c38=_0x43eaee;return db[_0x1a2c38('0x13')]['findOne']({'where':{'id':_0x5d7ccf[_0x1a2c38('0x9')]['id']}})[_0x1a2c38('0x21')](function(_0x725005){const _0x5bbb72=_0x1a2c38;if(_0x725005)return _0x725005[_0x5bbb72('0x30')](_0x5d7ccf[_0x5bbb72('0x4')]['ids'],{'through':_[_0x5bbb72('0x3e')](_0x5d7ccf['body'],['ids','id'])});})[_0x1a2c38('0x21')](respondWithResult(_0x28168b,null))[_0x1a2c38('0x2e')](handleError(_0x28168b,null));},exports[_0x43eaee('0x23')]=function(_0x5e7f9d,_0x54989f){const _0x4a9cbb=_0x43eaee;let _0x165cca={};const _0x25ebb6={};let _0x36aaf5,_0x551f73;return db[_0x4a9cbb('0x15')]['findOne']({'where':{'id':_0x5e7f9d[_0x4a9cbb('0x9')]['id']}})[_0x4a9cbb('0x21')](handleEntityNotFound(_0x54989f,null))[_0x4a9cbb('0x21')](function(_0xd3bdb9){const _0x1cb054=_0x4a9cbb;if(_0xd3bdb9)return _0x36aaf5=_0xd3bdb9,_0x25ebb6[_0x1cb054('0x12')]=_[_0x1cb054('0x2f')](db[_0x1cb054('0x13')][_0x1cb054('0x2d')]),_0x25ebb6[_0x1cb054('0x32')]=_[_0x1cb054('0x2f')](_0x5e7f9d[_0x1cb054('0x32')]),_0x25ebb6[_0x1cb054('0x1f')]=_[_0x1cb054('0x3d')](_0x25ebb6['model'],_0x25ebb6['query']),_0x165cca[_0x1cb054('0xe')]=_[_0x1cb054('0x3d')](_0x25ebb6[_0x1cb054('0x12')],qs['fields'](_0x5e7f9d['query'][_0x1cb054('0x2')])),_0x165cca[_0x1cb054('0xe')]=_0x165cca['attributes'][_0x1cb054('0x19')]?_0x165cca[_0x1cb054('0xe')]:_0x25ebb6[_0x1cb054('0x12')],_0x165cca[_0x1cb054('0x34')]=qs[_0x1cb054('0xc')](_0x5e7f9d[_0x1cb054('0x32')][_0x1cb054('0xc')]),_0x165cca[_0x1cb054('0x27')]=qs[_0x1cb054('0x1f')](_[_0x1cb054('0x39')](_0x5e7f9d[_0x1cb054('0x32')],_0x25ebb6['filters'])),_0x5e7f9d[_0x1cb054('0x32')]['filter']&&(_0x165cca['where']=_[_0x1cb054('0xd')](_0x165cca[_0x1cb054('0x27')],{[Op['or']]:_[_0x1cb054('0x3c')](_0x165cca['attributes'],function(_0xf63d58){const _0x32f1b2=_0x1cb054,_0x5de46c={};return _0x5de46c[_0xf63d58]={[Op[_0x32f1b2('0x3')]]:'%'+_0x5e7f9d['query']['filter']+'%'},_0x5de46c;})})),_0x165cca=_[_0x1cb054('0xd')]({},_0x165cca,_0x5e7f9d['options']),_0x36aaf5[_0x1cb054('0x23')](_0x165cca);})[_0x4a9cbb('0x21')](function(_0x5ae06a){const _0x2fac63=_0x4a9cbb;if(_0x5ae06a)return _0x551f73=_0x5ae06a[_0x2fac63('0x19')],typeof _0x5e7f9d['query']['nolimit']===_0x2fac63('0x31')&&(_0x165cca[_0x2fac63('0x38')]=qs[_0x2fac63('0x38')](_0x5e7f9d[_0x2fac63('0x32')][_0x2fac63('0x38')]),_0x165cca['offset']=qs['offset'](_0x5e7f9d[_0x2fac63('0x32')][_0x2fac63('0x8')])),_0x36aaf5[_0x2fac63('0x23')](_0x165cca);})[_0x4a9cbb('0x21')](function(_0x4ae498){if(_0x4ae498)return _0x4ae498?{'count':_0x551f73,'rows':_0x4ae498}:null;})[_0x4a9cbb('0x21')](respondWithResult(_0x54989f,null))[_0x4a9cbb('0x2e')](handleError(_0x54989f,null));};
\ No newline at end of file
+const a122_0x1dd1=['findOne','model','name','findAll','count','create','includeAll','api','filter','get','autoAssociation','rows','set','lodash','status','pick','filters','attributes','sort','update','query','UserProfileResource','map','stack','params','send','destroy','show','describe','where','include','../../config/logger','UserProfileSection','offset','userProfileId','CmCompany','omit','length','fields','error','Unable\x20to\x20retrieve\x20the\x20current\x20user','getContacts','order','body','rawAttributes','json','keys','addContacts','sendStatus','index','Companies','like','intersection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','then','user','catch','undefined','limit','merge','CmContact','options','end','ids'];(function(_0x300ed4,_0x1dd136){const _0x48e3cf=function(_0x168976){while(--_0x168976){_0x300ed4['push'](_0x300ed4['shift']());}};_0x48e3cf(++_0x1dd136);}(a122_0x1dd1,0x131));const a122_0x48e3=function(_0x300ed4,_0x1dd136){_0x300ed4=_0x300ed4-0x0;let _0x48e3cf=a122_0x1dd1[_0x300ed4];return _0x48e3cf;};const _0x4555fc=a122_0x48e3;'use strict';const _=require(_0x4555fc('0x1c')),qs=require('../../components/parsers/qs'),logger=require(_0x4555fc('0x2e'))(_0x4555fc('0x16')),db=require('../../mysqldb')['db'],{Op}=require('sequelize');function respondWithResult(_0x168976,_0x1b4387){return _0x1b4387=_0x1b4387||0xc8,function(_0x156265){const _0x559f9b=a122_0x48e3;if(_0x156265)return _0x168976[_0x559f9b('0x1d')](_0x1b4387)[_0x559f9b('0x3c')](_0x156265);};}function respondWithFilteredResult(_0x3250b1,_0xf04eff){return function(_0x5b034f){const _0x4c034e=a122_0x48e3;if(_0x5b034f){const _0x1bd60d=_0x5b034f[_0x4c034e('0x13')],_0x2a787b=_0xf04eff[_0x4c034e('0x30')];let _0x277920=_0xf04eff[_0x4c034e('0x30')]+_0xf04eff[_0x4c034e('0x9')],_0x46096b;return _0x277920>=_0x1bd60d?(_0x277920=_0x1bd60d,_0x46096b=0xc8):_0x46096b=0xce,_0x3250b1['status'](_0x46096b),_0x3250b1[_0x4c034e('0x1b')]('Content-Range',_0x2a787b+'-'+_0x277920+'/'+_0x1bd60d)[_0x4c034e('0x3c')](_0x5b034f);}return null;};}function saveUpdates(_0x46dbd3){return function(_0x128a07){const _0x36b82b=a122_0x48e3;if(_0x128a07)return _0x128a07[_0x36b82b('0x22')](_0x46dbd3)[_0x36b82b('0x5')](function(_0x49b357){return _0x49b357;});return null;};}function removeEntity(_0x43e8c8){return function(_0x4cd5e9){const _0x550f4e=a122_0x48e3;if(_0x4cd5e9)return _0x4cd5e9[_0x550f4e('0x29')]()[_0x550f4e('0x5')](function(){const _0x453947=_0x550f4e,_0x520545=_0x4cd5e9[_0x453947('0x18')]({'plain':!![]}),_0x2b5fa7='Companies';return db[_0x453947('0x24')][_0x453947('0x29')]({'where':{'type':_0x2b5fa7,'resourceId':_0x520545['id']}})['then'](function(){return _0x4cd5e9;});})['then'](function(){const _0xc2a16c=_0x550f4e;_0x43e8c8[_0xc2a16c('0x1d')](0xcc)[_0xc2a16c('0xd')]();});};}function handleEntityNotFound(_0x3e35df){return function(_0x26c152){const _0x3512d4=a122_0x48e3;return!_0x26c152&&_0x3e35df[_0x3512d4('0x3f')](0x194),_0x26c152;};}function handleError(_0x1bb0e7,_0x4fdfa5){return _0x4fdfa5=_0x4fdfa5||0x1f4,function(_0x590927){const _0x3adf9f=a122_0x48e3;logger[_0x3adf9f('0x36')](_0x590927[_0x3adf9f('0x26')]),_0x590927['name']&&delete _0x590927[_0x3adf9f('0x11')],_0x1bb0e7[_0x3adf9f('0x1d')](_0x4fdfa5)[_0x3adf9f('0x28')](_0x590927);};}exports[_0x4555fc('0x0')]=function(_0x4f650a,_0x3575c0){const _0x60447b=_0x4555fc;let _0x3845df={};const _0x23dfb5={},_0x44055c={'count':0x0,'rows':[]};return db[_0x60447b('0x32')][_0x60447b('0x2b')]()[_0x60447b('0x5')](function(_0x402b35){const _0x59666c=_0x60447b;_0x23dfb5['model']=_['keys'](_0x402b35),_0x23dfb5['query']=_[_0x59666c('0x3d')](_0x4f650a[_0x59666c('0x23')]),_0x23dfb5[_0x59666c('0x1f')]=_[_0x59666c('0x3')](_0x23dfb5[_0x59666c('0x10')],_0x23dfb5[_0x59666c('0x23')]),_0x3845df[_0x59666c('0x20')]=_['intersection'](_0x23dfb5[_0x59666c('0x10')],qs[_0x59666c('0x35')](_0x4f650a[_0x59666c('0x23')][_0x59666c('0x35')])),_0x3845df[_0x59666c('0x20')]=_0x3845df[_0x59666c('0x20')][_0x59666c('0x34')]?_0x3845df[_0x59666c('0x20')]:_0x23dfb5['model'];typeof _0x4f650a[_0x59666c('0x23')]['nolimit']===_0x59666c('0x8')&&(_0x3845df[_0x59666c('0x9')]=qs['limit'](_0x4f650a[_0x59666c('0x23')][_0x59666c('0x9')]),_0x3845df['offset']=qs[_0x59666c('0x30')](_0x4f650a[_0x59666c('0x23')][_0x59666c('0x30')]));_0x3845df[_0x59666c('0x39')]=qs[_0x59666c('0x21')](_0x4f650a[_0x59666c('0x23')][_0x59666c('0x21')]),_0x3845df[_0x59666c('0x2c')]=qs[_0x59666c('0x1f')](_['pick'](_0x4f650a['query'],_0x23dfb5[_0x59666c('0x1f')]),_0x402b35);_0x4f650a[_0x59666c('0x23')][_0x59666c('0x17')]&&(_0x3845df[_0x59666c('0x2c')]=_[_0x59666c('0xa')](_0x3845df[_0x59666c('0x2c')],{[Op['or']]:_[_0x59666c('0x25')](_0x3845df[_0x59666c('0x20')],function(_0x3be635){const _0x31b1df=_0x59666c,_0x21cb17={};return _0x21cb17[_0x3be635]={[Op[_0x31b1df('0x2')]]:'%'+_0x4f650a['query'][_0x31b1df('0x17')]+'%'},_0x21cb17;})}));_0x3845df=_[_0x59666c('0xa')]({},_0x3845df,_0x4f650a['options']);const _0x200205={'where':_0x3845df['where']};return db[_0x59666c('0x32')][_0x59666c('0x13')](_0x200205)['then'](function(_0x8852b8){const _0x4bf630=_0x59666c;return _0x44055c[_0x4bf630('0x13')]=_0x8852b8,_0x4f650a[_0x4bf630('0x23')][_0x4bf630('0x15')]&&(_0x3845df[_0x4bf630('0x2d')]=[{'all':!![]}]),db[_0x4bf630('0x32')][_0x4bf630('0x12')](_0x3845df);})['then'](function(_0x4898a6){const _0x17497e=_0x59666c;return _0x44055c[_0x17497e('0x1a')]=_0x4898a6,_0x44055c;})[_0x59666c('0x5')](respondWithFilteredResult(_0x3575c0,_0x3845df))[_0x59666c('0x7')](handleError(_0x3575c0,null));})[_0x60447b('0x7')](handleError(_0x3575c0,null));},exports[_0x4555fc('0x2a')]=function(_0x3d17b4,_0x121770){const _0x51bd0d=_0x4555fc;let _0x5a14df={'raw':![],'where':{'id':_0x3d17b4[_0x51bd0d('0x27')]['id']}};const _0x5043ba={};return _0x5043ba[_0x51bd0d('0x10')]=_['keys'](db['CmCompany'][_0x51bd0d('0x3b')]),_0x5043ba['query']=_[_0x51bd0d('0x3d')](_0x3d17b4[_0x51bd0d('0x23')]),_0x5043ba[_0x51bd0d('0x1f')]=_[_0x51bd0d('0x3')](_0x5043ba['model'],_0x5043ba['query']),_0x5a14df[_0x51bd0d('0x20')]=_[_0x51bd0d('0x3')](_0x5043ba[_0x51bd0d('0x10')],qs['fields'](_0x3d17b4[_0x51bd0d('0x23')][_0x51bd0d('0x35')])),_0x5a14df[_0x51bd0d('0x20')]=_0x5a14df['attributes'][_0x51bd0d('0x34')]?_0x5a14df['attributes']:_0x5043ba['model'],_0x3d17b4[_0x51bd0d('0x23')][_0x51bd0d('0x15')]&&(_0x5a14df['include']=[{'all':!![]}]),_0x5a14df=_[_0x51bd0d('0xa')]({},_0x5a14df,_0x3d17b4[_0x51bd0d('0xc')]),db[_0x51bd0d('0x32')]['findOne'](_0x5a14df)[_0x51bd0d('0x5')](handleEntityNotFound(_0x121770,null))[_0x51bd0d('0x5')](respondWithResult(_0x121770,null))['catch'](handleError(_0x121770,null));},exports[_0x4555fc('0x14')]=function(_0x4308c5,_0x333dff){const _0x4a0657=_0x4555fc;return db[_0x4a0657('0x32')][_0x4a0657('0x14')](_0x4308c5[_0x4a0657('0x3a')],{})[_0x4a0657('0x5')](function(_0x42e7f9){const _0x1e31ab=_0x4a0657,_0x59be74=_0x4308c5[_0x1e31ab('0x6')][_0x1e31ab('0x18')]({'plain':!![]});if(!_0x59be74)throw new Error(_0x1e31ab('0x37'));if(_0x59be74['role']===_0x1e31ab('0x6')){const _0x3de986=_0x42e7f9[_0x1e31ab('0x18')]({'plain':!![]}),_0x3736b0=_0x1e31ab('0x1');return db[_0x1e31ab('0x2f')][_0x1e31ab('0xf')]({'where':{'name':_0x3736b0,'userProfileId':_0x59be74[_0x1e31ab('0x31')]},'raw':!![]})[_0x1e31ab('0x5')](function(_0x20e7a1){const _0x3f73d9=_0x1e31ab;return _0x20e7a1&&_0x20e7a1[_0x3f73d9('0x19')]===0x0?db['UserProfileResource'][_0x3f73d9('0x14')]({'name':_0x3de986['name'],'resourceId':_0x3de986['id'],'type':_0x20e7a1[_0x3f73d9('0x11')],'sectionId':_0x20e7a1['id']},{})[_0x3f73d9('0x5')](function(){return _0x42e7f9;}):_0x42e7f9;})[_0x1e31ab('0x7')](function(_0x954d19){const _0xe78123=_0x1e31ab;logger[_0xe78123('0x36')](_0xe78123('0x4'),_0x954d19);throw _0x954d19;});}return _0x42e7f9;})[_0x4a0657('0x5')](respondWithResult(_0x333dff,0xc9))[_0x4a0657('0x7')](handleError(_0x333dff,null));},exports['update']=function(_0x259a45,_0x41d8c6){const _0x828f32=_0x4555fc;return _0x259a45['body']['id']&&delete _0x259a45[_0x828f32('0x3a')]['id'],db['CmCompany'][_0x828f32('0xf')]({'where':{'id':_0x259a45[_0x828f32('0x27')]['id']}})['then'](handleEntityNotFound(_0x41d8c6,null))[_0x828f32('0x5')](saveUpdates(_0x259a45['body'],null))['then'](respondWithResult(_0x41d8c6,null))[_0x828f32('0x7')](handleError(_0x41d8c6,null));},exports['destroy']=function(_0x243abb,_0x3042a8){const _0x2d8e39=_0x4555fc;return db[_0x2d8e39('0x32')]['findOne']({'where':{'id':_0x243abb[_0x2d8e39('0x27')]['id']}})[_0x2d8e39('0x5')](handleEntityNotFound(_0x3042a8,null))['then'](removeEntity(_0x3042a8,null))[_0x2d8e39('0x7')](handleError(_0x3042a8,null));},exports[_0x4555fc('0x2b')]=function(_0x18f800,_0x4e6246){const _0x45cd04=_0x4555fc;return db[_0x45cd04('0x32')][_0x45cd04('0x2b')]()[_0x45cd04('0x5')](respondWithResult(_0x4e6246,null))['catch'](handleError(_0x4e6246,null));},exports[_0x4555fc('0x3e')]=function(_0x5987a7,_0x356712){const _0x3118d0=_0x4555fc;return db[_0x3118d0('0xb')][_0x3118d0('0xf')]({'where':{'id':_0x5987a7[_0x3118d0('0x27')]['id']}})[_0x3118d0('0x5')](function(_0x20a9ec){const _0x284085=_0x3118d0;if(_0x20a9ec)return _0x20a9ec[_0x284085('0x3e')](_0x5987a7[_0x284085('0x3a')][_0x284085('0xe')],{'through':_[_0x284085('0x33')](_0x5987a7[_0x284085('0x3a')],[_0x284085('0xe'),'id'])});})['then'](respondWithResult(_0x356712,null))['catch'](handleError(_0x356712,null));},exports[_0x4555fc('0x38')]=function(_0x2045dd,_0x449ab6){const _0x407032=_0x4555fc;let _0x44f9ea={};const _0x415620={};let _0x18239e,_0x3ece8a;return db[_0x407032('0x32')]['findOne']({'where':{'id':_0x2045dd['params']['id']}})['then'](handleEntityNotFound(_0x449ab6,null))[_0x407032('0x5')](function(_0x4442db){const _0x35e99e=_0x407032;if(_0x4442db)return _0x18239e=_0x4442db,_0x415620[_0x35e99e('0x10')]=_[_0x35e99e('0x3d')](db[_0x35e99e('0xb')][_0x35e99e('0x3b')]),_0x415620['query']=_[_0x35e99e('0x3d')](_0x2045dd[_0x35e99e('0x23')]),_0x415620[_0x35e99e('0x1f')]=_[_0x35e99e('0x3')](_0x415620[_0x35e99e('0x10')],_0x415620['query']),_0x44f9ea[_0x35e99e('0x20')]=_['intersection'](_0x415620[_0x35e99e('0x10')],qs[_0x35e99e('0x35')](_0x2045dd['query']['fields'])),_0x44f9ea[_0x35e99e('0x20')]=_0x44f9ea[_0x35e99e('0x20')][_0x35e99e('0x34')]?_0x44f9ea[_0x35e99e('0x20')]:_0x415620[_0x35e99e('0x10')],_0x44f9ea[_0x35e99e('0x39')]=qs[_0x35e99e('0x21')](_0x2045dd['query'][_0x35e99e('0x21')]),_0x44f9ea['where']=qs[_0x35e99e('0x1f')](_[_0x35e99e('0x1e')](_0x2045dd[_0x35e99e('0x23')],_0x415620[_0x35e99e('0x1f')])),_0x2045dd[_0x35e99e('0x23')][_0x35e99e('0x17')]&&(_0x44f9ea[_0x35e99e('0x2c')]=_['merge'](_0x44f9ea['where'],{[Op['or']]:_[_0x35e99e('0x25')](_0x44f9ea[_0x35e99e('0x20')],function(_0x150835){const _0x4ba777=_0x35e99e,_0xc8e84d={};return _0xc8e84d[_0x150835]={[Op[_0x4ba777('0x2')]]:'%'+_0x2045dd[_0x4ba777('0x23')][_0x4ba777('0x17')]+'%'},_0xc8e84d;})})),_0x44f9ea=_['merge']({},_0x44f9ea,_0x2045dd[_0x35e99e('0xc')]),_0x18239e['getContacts'](_0x44f9ea);})[_0x407032('0x5')](function(_0x2b7ee3){const _0x247e2d=_0x407032;if(_0x2b7ee3)return _0x3ece8a=_0x2b7ee3['length'],typeof _0x2045dd[_0x247e2d('0x23')]['nolimit']===_0x247e2d('0x8')&&(_0x44f9ea[_0x247e2d('0x9')]=qs[_0x247e2d('0x9')](_0x2045dd[_0x247e2d('0x23')][_0x247e2d('0x9')]),_0x44f9ea[_0x247e2d('0x30')]=qs['offset'](_0x2045dd[_0x247e2d('0x23')][_0x247e2d('0x30')])),_0x18239e[_0x247e2d('0x38')](_0x44f9ea);})['then'](function(_0x498dd9){if(_0x498dd9)return _0x498dd9?{'count':_0x3ece8a,'rows':_0x498dd9}:null;})['then'](respondWithResult(_0x449ab6,null))[_0x407032('0x7')](handleError(_0x449ab6,null));};
\ No newline at end of file