Built motion from commit f861bcb808219e66da88ba48b61bddb35224a65e. Version 3.0.0...
[motion-next.git] / server / api / cmCompany / cmCompany.controller.js
index a69cd1f..ccd575a 100644 (file)
@@ -1 +1 @@
-'use strict';const a146_0x3baa=['filter','CmContact','include','2eRTwXd','query','name','omit','getContacts','order','1531YlFUSP','includeAll','describe','autoAssociation','limit','addContacts','UserProfileSection','model','user','merge','970244ovcAxl','length','json','fields','Unable\x20to\x20retrieve\x20the\x20current\x20user','23KknWLr','undefined','319591AtYmxo','get','findAll','1430999xHdfMo','intersection','@mysqldb','Companies','22285TWwCIB','userProfileId','show','findOne','update','catch','error','params','end','send','filters','offset','@components/parsers/qs','557217DdgbYR','sort','destroy','@utils/filter-attributes','pick','attributes','body','where','12RNzIoc','nolimit','81eWZida','count','role','options','status','@config/logger','ids','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sendStatus','stack','CmCompany','UserProfileResource','api','index','9189lMFQyO','then','rows','rawAttributes','keys'];const a146_0x31de=function(_0x500442,_0x2a8ea6){_0x500442=_0x500442-0xf7;let _0x3baa26=a146_0x3baa[_0x500442];return _0x3baa26;};const a146_0x2335f2=a146_0x31de;(function(_0x2d8642,_0x38aa79){const _0x346a12=a146_0x31de;while(!![]){try{const _0x44f1b5=-parseInt(_0x346a12(0x13d))*parseInt(_0x346a12(0x12d))+-parseInt(_0x346a12(0xfa))*parseInt(_0x346a12(0x111))+-parseInt(_0x346a12(0x118))*-parseInt(_0x346a12(0x12f))+-parseInt(_0x346a12(0x10a))+parseInt(_0x346a12(0x114))+-parseInt(_0x346a12(0x125))+-parseInt(_0x346a12(0x100))*-parseInt(_0x346a12(0x10f));if(_0x44f1b5===_0x38aa79)break;else _0x2d8642['push'](_0x2d8642['shift']());}catch(_0xc7647e){_0x2d8642['push'](_0x2d8642['shift']());}}}(a146_0x3baa,0xf2c52));const _=require('lodash'),qs=require(a146_0x2335f2(0x124)),logger=require(a146_0x2335f2(0x134))(a146_0x2335f2(0x13b)),{db}=require(a146_0x2335f2(0x116)),{filterAttributes}=require(a146_0x2335f2(0x128));function respondWithResult(_0x217ca8,_0x1689af){return _0x1689af=_0x1689af||0xc8,function(_0x4e9109){const _0x1bfce5=a146_0x31de;if(_0x4e9109)return _0x217ca8[_0x1bfce5(0x133)](_0x1689af)[_0x1bfce5(0x10c)](_0x4e9109);};}function respondWithFilteredResult(_0x17da96,_0x76af85){return function(_0x29b6a8){const _0x4452ca=a146_0x31de;if(_0x29b6a8){const _0x4b8146=_0x29b6a8[_0x4452ca(0x130)],_0x3fdda3=_0x76af85[_0x4452ca(0x123)];let _0x16899c=_0x76af85[_0x4452ca(0x123)]+_0x76af85[_0x4452ca(0x104)],_0x4990c6;return _0x16899c>=_0x4b8146?(_0x16899c=_0x4b8146,_0x4990c6=0xc8):_0x4990c6=0xce,_0x17da96['status'](_0x4990c6),_0x17da96['set']('Content-Range',_0x3fdda3+'-'+_0x16899c+'/'+_0x4b8146)[_0x4452ca(0x10c)](_0x29b6a8);}return null;};}function saveUpdates(_0x1483d7){return function(_0x1763ed){const _0x47e0ef=a146_0x31de;if(_0x1763ed)return _0x1763ed[_0x47e0ef(0x11c)](_0x1483d7)['then'](function(_0x316b44){return _0x316b44;});return null;};}function removeEntity(_0x243d99){return function(_0x21fa38){const _0x4f9f9d=a146_0x31de;if(_0x21fa38)return _0x21fa38[_0x4f9f9d(0x127)]()[_0x4f9f9d(0x13e)](function(){const _0x29b07f=_0x4f9f9d,_0x2557ce=_0x21fa38['get']({'plain':!![]}),_0x18e285='Companies';return db[_0x29b07f(0x13a)][_0x29b07f(0x127)]({'where':{'type':_0x18e285,'resourceId':_0x2557ce['id']}})[_0x29b07f(0x13e)](function(){return _0x21fa38;});})[_0x4f9f9d(0x13e)](function(){const _0xb2bcd4=_0x4f9f9d;_0x243d99[_0xb2bcd4(0x133)](0xcc)[_0xb2bcd4(0x120)]();});};}function handleEntityNotFound(_0x498686){return function(_0x29d12f){const _0x345dec=a146_0x31de;return!_0x29d12f&&_0x498686[_0x345dec(0x137)](0x194),_0x29d12f;};}function handleError(_0x1ed1e9,_0x16a6a2){return _0x16a6a2=_0x16a6a2||0x1f4,function(_0x43deba){const _0x507d2c=a146_0x31de;logger[_0x507d2c(0x11e)](_0x43deba[_0x507d2c(0x138)]),_0x43deba[_0x507d2c(0xfc)]&&delete _0x43deba[_0x507d2c(0xfc)],_0x1ed1e9[_0x507d2c(0x133)](_0x16a6a2)[_0x507d2c(0x121)](_0x43deba);};}exports[a146_0x2335f2(0x13c)]=function(_0x373622,_0x5988dc){const _0x5fbb24=a146_0x2335f2;let _0x304af9={};const _0x4c3722={},_0x4ef5cf={'count':0x0,'rows':[]};return db[_0x5fbb24(0x139)][_0x5fbb24(0x102)]()[_0x5fbb24(0x13e)](function(_0x14ad42){const _0x2b4a1a=_0x5fbb24;_0x4c3722[_0x2b4a1a(0x107)]=_['keys'](_0x14ad42),_0x4c3722['query']=_[_0x2b4a1a(0x141)](_0x373622['query']),_0x4c3722['filters']=_[_0x2b4a1a(0x115)](_0x4c3722['model'],_0x4c3722['query']),_0x304af9[_0x2b4a1a(0x12a)]=_['intersection'](_0x4c3722['model'],qs[_0x2b4a1a(0x10d)](_0x373622[_0x2b4a1a(0xfb)]['fields'])),_0x304af9[_0x2b4a1a(0x12a)]=_0x304af9[_0x2b4a1a(0x12a)]['length']?_0x304af9[_0x2b4a1a(0x12a)]:_0x4c3722[_0x2b4a1a(0x107)];typeof _0x373622[_0x2b4a1a(0xfb)]['nolimit']===_0x2b4a1a(0x110)&&(_0x304af9[_0x2b4a1a(0x104)]=qs[_0x2b4a1a(0x104)](_0x373622[_0x2b4a1a(0xfb)][_0x2b4a1a(0x104)]),_0x304af9['offset']=qs[_0x2b4a1a(0x123)](_0x373622[_0x2b4a1a(0xfb)][_0x2b4a1a(0x123)]));_0x304af9['order']=qs[_0x2b4a1a(0x126)](_0x373622[_0x2b4a1a(0xfb)][_0x2b4a1a(0x126)]),_0x304af9[_0x2b4a1a(0x12c)]=qs[_0x2b4a1a(0x122)](_['pick'](_0x373622[_0x2b4a1a(0xfb)],_0x4c3722[_0x2b4a1a(0x122)]),_0x14ad42);_0x373622['query'][_0x2b4a1a(0xf7)]&&(_0x304af9=filterAttributes(_0x304af9,_0x373622[_0x2b4a1a(0xfb)]['filter'],_0x304af9[_0x2b4a1a(0x12a)],_0x373622[_0x2b4a1a(0x132)],![]));_0x304af9=_[_0x2b4a1a(0x109)]({},_0x304af9,_0x373622[_0x2b4a1a(0x132)]);const _0x310c2e={'where':_0x304af9[_0x2b4a1a(0x12c)]};return db[_0x2b4a1a(0x139)]['count'](_0x310c2e)['then'](function(_0x5e3a41){const _0x487578=_0x2b4a1a;return _0x4ef5cf[_0x487578(0x130)]=_0x5e3a41,_0x373622[_0x487578(0xfb)][_0x487578(0x101)]&&(_0x304af9[_0x487578(0xf9)]=[{'all':!![]}]),db[_0x487578(0x139)][_0x487578(0x113)](_0x304af9);})[_0x2b4a1a(0x13e)](function(_0x4a0c78){const _0x490743=_0x2b4a1a;return _0x4ef5cf[_0x490743(0x13f)]=_0x4a0c78,_0x4ef5cf;})[_0x2b4a1a(0x13e)](respondWithFilteredResult(_0x5988dc,_0x304af9))[_0x2b4a1a(0x11d)](handleError(_0x5988dc,null));})[_0x5fbb24(0x11d)](handleError(_0x5988dc,null));},exports[a146_0x2335f2(0x11a)]=function(_0x5c20ad,_0x53663d){const _0x51f234=a146_0x2335f2;let _0x4a6537={'raw':![],'where':{'id':_0x5c20ad['params']['id']}};const _0x1a6f5d={};return _0x1a6f5d[_0x51f234(0x107)]=_[_0x51f234(0x141)](db[_0x51f234(0x139)]['rawAttributes']),_0x1a6f5d['query']=_['keys'](_0x5c20ad[_0x51f234(0xfb)]),_0x1a6f5d[_0x51f234(0x122)]=_[_0x51f234(0x115)](_0x1a6f5d[_0x51f234(0x107)],_0x1a6f5d[_0x51f234(0xfb)]),_0x4a6537[_0x51f234(0x12a)]=_[_0x51f234(0x115)](_0x1a6f5d[_0x51f234(0x107)],qs['fields'](_0x5c20ad[_0x51f234(0xfb)][_0x51f234(0x10d)])),_0x4a6537[_0x51f234(0x12a)]=_0x4a6537[_0x51f234(0x12a)][_0x51f234(0x10b)]?_0x4a6537[_0x51f234(0x12a)]:_0x1a6f5d[_0x51f234(0x107)],_0x5c20ad[_0x51f234(0xfb)][_0x51f234(0x101)]&&(_0x4a6537[_0x51f234(0xf9)]=[{'all':!![]}]),_0x4a6537=_[_0x51f234(0x109)]({},_0x4a6537,_0x5c20ad['options']),db[_0x51f234(0x139)]['findOne'](_0x4a6537)[_0x51f234(0x13e)](handleEntityNotFound(_0x53663d,null))['then'](respondWithResult(_0x53663d,null))[_0x51f234(0x11d)](handleError(_0x53663d,null));},exports['create']=function(_0x4e404d,_0x365d6d){const _0x58650b=a146_0x2335f2;return db[_0x58650b(0x139)]['create'](_0x4e404d['body'],{})[_0x58650b(0x13e)](function(_0x1ff261){const _0x52bc92=_0x58650b,_0x317c91=_0x4e404d[_0x52bc92(0x108)][_0x52bc92(0x112)]({'plain':!![]});if(!_0x317c91)throw new Error(_0x52bc92(0x10e));if(_0x317c91[_0x52bc92(0x131)]===_0x52bc92(0x108)){const _0x3df266=_0x1ff261[_0x52bc92(0x112)]({'plain':!![]}),_0x39fd2e=_0x52bc92(0x117);return db[_0x52bc92(0x106)][_0x52bc92(0x11b)]({'where':{'name':_0x39fd2e,'userProfileId':_0x317c91[_0x52bc92(0x119)]},'raw':!![]})[_0x52bc92(0x13e)](function(_0x24dc18){const _0xb9ca1b=_0x52bc92;return _0x24dc18&&_0x24dc18[_0xb9ca1b(0x103)]===0x0?db['UserProfileResource']['create']({'name':_0x3df266[_0xb9ca1b(0xfc)],'resourceId':_0x3df266['id'],'type':_0x24dc18[_0xb9ca1b(0xfc)],'sectionId':_0x24dc18['id']},{})['then'](function(){return _0x1ff261;}):_0x1ff261;})[_0x52bc92(0x11d)](function(_0x23e894){const _0x4bdb42=_0x52bc92;logger[_0x4bdb42(0x11e)](_0x4bdb42(0x136),_0x23e894);throw _0x23e894;});}return _0x1ff261;})['then'](respondWithResult(_0x365d6d,0xc9))[_0x58650b(0x11d)](handleError(_0x365d6d,null));},exports[a146_0x2335f2(0x11c)]=function(_0x4159a4,_0x14373a){const _0x1adea1=a146_0x2335f2;return _0x4159a4[_0x1adea1(0x12b)]['id']&&delete _0x4159a4[_0x1adea1(0x12b)]['id'],db[_0x1adea1(0x139)][_0x1adea1(0x11b)]({'where':{'id':_0x4159a4[_0x1adea1(0x11f)]['id']}})[_0x1adea1(0x13e)](handleEntityNotFound(_0x14373a,null))[_0x1adea1(0x13e)](saveUpdates(_0x4159a4[_0x1adea1(0x12b)],null))[_0x1adea1(0x13e)](respondWithResult(_0x14373a,null))['catch'](handleError(_0x14373a,null));},exports['destroy']=function(_0x39c1ae,_0x55e2b0){const _0x391a9c=a146_0x2335f2;return db[_0x391a9c(0x139)][_0x391a9c(0x11b)]({'where':{'id':_0x39c1ae[_0x391a9c(0x11f)]['id']}})[_0x391a9c(0x13e)](handleEntityNotFound(_0x55e2b0,null))[_0x391a9c(0x13e)](removeEntity(_0x55e2b0,null))['catch'](handleError(_0x55e2b0,null));},exports[a146_0x2335f2(0x102)]=function(_0x4b4f24,_0x211d40){const _0xcf7db6=a146_0x2335f2;return db[_0xcf7db6(0x139)]['describe']()['then'](respondWithResult(_0x211d40,null))['catch'](handleError(_0x211d40,null));},exports[a146_0x2335f2(0x105)]=function(_0x71bcc5,_0x7863d7){const _0x5ae726=a146_0x2335f2;return db['CmContact'][_0x5ae726(0x11b)]({'where':{'id':_0x71bcc5[_0x5ae726(0x11f)]['id']}})[_0x5ae726(0x13e)](function(_0x3dcc16){const _0x170e8d=_0x5ae726;if(_0x3dcc16)return _0x3dcc16[_0x170e8d(0x105)](_0x71bcc5[_0x170e8d(0x12b)][_0x170e8d(0x135)],{'through':_[_0x170e8d(0xfd)](_0x71bcc5[_0x170e8d(0x12b)],[_0x170e8d(0x135),'id'])});})[_0x5ae726(0x13e)](respondWithResult(_0x7863d7,null))[_0x5ae726(0x11d)](handleError(_0x7863d7,null));},exports[a146_0x2335f2(0xfe)]=function(_0x7b128a,_0x75c960){const _0x104711=a146_0x2335f2;let _0xac702a={};const _0x1a8c18={};let _0x1fca4f,_0x25046c;return db[_0x104711(0x139)][_0x104711(0x11b)]({'where':{'id':_0x7b128a[_0x104711(0x11f)]['id']}})[_0x104711(0x13e)](handleEntityNotFound(_0x75c960,null))[_0x104711(0x13e)](function(_0x4e87d0){const _0x18aa00=_0x104711;if(_0x4e87d0)return _0x1fca4f=_0x4e87d0,_0x1a8c18[_0x18aa00(0x107)]=_[_0x18aa00(0x141)](db[_0x18aa00(0xf8)][_0x18aa00(0x140)]),_0x1a8c18[_0x18aa00(0xfb)]=_[_0x18aa00(0x141)](_0x7b128a['query']),_0x1a8c18[_0x18aa00(0x122)]=_[_0x18aa00(0x115)](_0x1a8c18[_0x18aa00(0x107)],_0x1a8c18[_0x18aa00(0xfb)]),_0xac702a['attributes']=_[_0x18aa00(0x115)](_0x1a8c18[_0x18aa00(0x107)],qs[_0x18aa00(0x10d)](_0x7b128a[_0x18aa00(0xfb)]['fields'])),_0xac702a[_0x18aa00(0x12a)]=_0xac702a[_0x18aa00(0x12a)][_0x18aa00(0x10b)]?_0xac702a[_0x18aa00(0x12a)]:_0x1a8c18[_0x18aa00(0x107)],_0xac702a[_0x18aa00(0xff)]=qs[_0x18aa00(0x126)](_0x7b128a[_0x18aa00(0xfb)]['sort']),_0xac702a[_0x18aa00(0x12c)]=qs['filters'](_[_0x18aa00(0x129)](_0x7b128a[_0x18aa00(0xfb)],_0x1a8c18[_0x18aa00(0x122)])),_0xac702a=filterAttributes(_0xac702a,_0x7b128a['query'][_0x18aa00(0xf7)],_0xac702a['attributes'],_0x7b128a[_0x18aa00(0x132)],![]),_0x1fca4f[_0x18aa00(0xfe)](_0xac702a);})[_0x104711(0x13e)](function(_0x501d1e){const _0x148e14=_0x104711;if(_0x501d1e)return _0x25046c=_0x501d1e[_0x148e14(0x10b)],typeof _0x7b128a[_0x148e14(0xfb)][_0x148e14(0x12e)]===_0x148e14(0x110)&&(_0xac702a[_0x148e14(0x104)]=qs['limit'](_0x7b128a[_0x148e14(0xfb)][_0x148e14(0x104)]),_0xac702a[_0x148e14(0x123)]=qs[_0x148e14(0x123)](_0x7b128a['query']['offset'])),_0x1fca4f[_0x148e14(0xfe)](_0xac702a);})[_0x104711(0x13e)](function(_0xff1715){if(_0xff1715)return _0xff1715?{'count':_0x25046c,'rows':_0xff1715}:null;})[_0x104711(0x13e)](respondWithResult(_0x75c960,null))[_0x104711(0x11d)](handleError(_0x75c960,null));};
\ No newline at end of file
+'use strict';const a146_0x2d05=['@config/logger','catch','end','sendStatus','describe','sort','findAll','status','set','get','error','CmCompany','UserProfileSection','filters','filter','CmContact','params','name','Companies','33rczDgV','user','intersection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','@utils/filter-attributes','2gFcXLL','1rhMELq','findOne','@components/parsers/qs','autoAssociation','model','role','includeAll','json','then','1063877MPMOoI','limit','rows','attributes','show','468306qZYFYH','fields','destroy','order','options','3471hrBPdq','nolimit','pick','update','686298wjDTLO','index','129PUYLcW','getContacts','rawAttributes','lodash','length','body','offset','where','query','2422bGYwId','create','send','undefined','count','omit','1075841pHChat','1842006exemyX','addContacts','ids','keys','merge'];const a146_0x75b3=function(_0x48f001,_0x84f927){_0x48f001=_0x48f001-0x19b;let _0x2d05e4=a146_0x2d05[_0x48f001];return _0x2d05e4;};const a146_0x5da71c=a146_0x75b3;(function(_0x48dd7a,_0x5967c2){const _0x55b0c4=a146_0x75b3;while(!![]){try{const _0x1f4afa=parseInt(_0x55b0c4(0x1a5))*parseInt(_0x55b0c4(0x19c))+-parseInt(_0x55b0c4(0x1af))*-parseInt(_0x55b0c4(0x1b5))+-parseInt(_0x55b0c4(0x1b3))+-parseInt(_0x55b0c4(0x1c4))+-parseInt(_0x55b0c4(0x1aa))*parseInt(_0x55b0c4(0x19b))+-parseInt(_0x55b0c4(0x1dd))*parseInt(_0x55b0c4(0x1be))+parseInt(_0x55b0c4(0x1c5));if(_0x1f4afa===_0x5967c2)break;else _0x48dd7a['push'](_0x48dd7a['shift']());}catch(_0x3ef611){_0x48dd7a['push'](_0x48dd7a['shift']());}}}(a146_0x2d05,0x8c5f5));const _=require(a146_0x5da71c(0x1b8)),qs=require(a146_0x5da71c(0x19e)),logger=require(a146_0x5da71c(0x1ca))('api'),{db}=require('@mysqldb'),{filterAttributes}=require(a146_0x5da71c(0x1e1));function respondWithResult(_0x224054,_0x7d20d){return _0x7d20d=_0x7d20d||0xc8,function(_0x40b54c){const _0x1e3bbf=a146_0x75b3;if(_0x40b54c)return _0x224054[_0x1e3bbf(0x1d1)](_0x7d20d)[_0x1e3bbf(0x1a3)](_0x40b54c);};}function respondWithFilteredResult(_0x4cd6f4,_0x1e0fdd){return function(_0x155474){const _0x3359c9=a146_0x75b3;if(_0x155474){const _0x331d6f=_0x155474['count'],_0x229d8d=_0x1e0fdd[_0x3359c9(0x1bb)];let _0x2b54a4=_0x1e0fdd[_0x3359c9(0x1bb)]+_0x1e0fdd[_0x3359c9(0x1a6)],_0x4f2fe7;return _0x2b54a4>=_0x331d6f?(_0x2b54a4=_0x331d6f,_0x4f2fe7=0xc8):_0x4f2fe7=0xce,_0x4cd6f4[_0x3359c9(0x1d1)](_0x4f2fe7),_0x4cd6f4[_0x3359c9(0x1d2)]('Content-Range',_0x229d8d+'-'+_0x2b54a4+'/'+_0x331d6f)[_0x3359c9(0x1a3)](_0x155474);}return null;};}function saveUpdates(_0x1b9943){return function(_0x320360){const _0x4222b2=a146_0x75b3;if(_0x320360)return _0x320360[_0x4222b2(0x1b2)](_0x1b9943)[_0x4222b2(0x1a4)](function(_0x4871dc){return _0x4871dc;});return null;};}function removeEntity(_0x523383){return function(_0x3a6e97){const _0x1420f4=a146_0x75b3;if(_0x3a6e97)return _0x3a6e97['destroy']()[_0x1420f4(0x1a4)](function(){const _0x224d1a=_0x1420f4,_0x58a9e8=_0x3a6e97[_0x224d1a(0x1d3)]({'plain':!![]}),_0x452f15=_0x224d1a(0x1dc);return db['UserProfileResource'][_0x224d1a(0x1ac)]({'where':{'type':_0x452f15,'resourceId':_0x58a9e8['id']}})['then'](function(){return _0x3a6e97;});})[_0x1420f4(0x1a4)](function(){const _0x521a49=_0x1420f4;_0x523383[_0x521a49(0x1d1)](0xcc)[_0x521a49(0x1cc)]();});};}function handleEntityNotFound(_0x57f7f6){return function(_0x2b357b){const _0x4f6526=a146_0x75b3;return!_0x2b357b&&_0x57f7f6[_0x4f6526(0x1cd)](0x194),_0x2b357b;};}function handleError(_0x2a4af3,_0xfe1750){return _0xfe1750=_0xfe1750||0x1f4,function(_0x3b3a64){const _0x28dff3=a146_0x75b3;logger[_0x28dff3(0x1d4)](_0x3b3a64['stack']),_0x3b3a64[_0x28dff3(0x1db)]&&delete _0x3b3a64[_0x28dff3(0x1db)],_0x2a4af3[_0x28dff3(0x1d1)](_0xfe1750)[_0x28dff3(0x1c0)](_0x3b3a64);};}exports[a146_0x5da71c(0x1b4)]=function(_0x59f70e,_0x11f922){const _0x1caae8=a146_0x5da71c;let _0xd99293={};const _0x55ba04={},_0x1f2587={'count':0x0,'rows':[]};return db[_0x1caae8(0x1d5)][_0x1caae8(0x1ce)]()[_0x1caae8(0x1a4)](function(_0x4cfe05){const _0x8987d4=_0x1caae8;_0x55ba04[_0x8987d4(0x1a0)]=_['keys'](_0x4cfe05),_0x55ba04[_0x8987d4(0x1bd)]=_['keys'](_0x59f70e[_0x8987d4(0x1bd)]),_0x55ba04[_0x8987d4(0x1d7)]=_[_0x8987d4(0x1df)](_0x55ba04[_0x8987d4(0x1a0)],_0x55ba04[_0x8987d4(0x1bd)]),_0xd99293['attributes']=_[_0x8987d4(0x1df)](_0x55ba04[_0x8987d4(0x1a0)],qs[_0x8987d4(0x1ab)](_0x59f70e[_0x8987d4(0x1bd)][_0x8987d4(0x1ab)])),_0xd99293['attributes']=_0xd99293['attributes']['length']?_0xd99293[_0x8987d4(0x1a8)]:_0x55ba04['model'];typeof _0x59f70e[_0x8987d4(0x1bd)][_0x8987d4(0x1b0)]===_0x8987d4(0x1c1)&&(_0xd99293[_0x8987d4(0x1a6)]=qs['limit'](_0x59f70e[_0x8987d4(0x1bd)][_0x8987d4(0x1a6)]),_0xd99293[_0x8987d4(0x1bb)]=qs[_0x8987d4(0x1bb)](_0x59f70e['query']['offset']));_0xd99293[_0x8987d4(0x1ad)]=qs[_0x8987d4(0x1cf)](_0x59f70e[_0x8987d4(0x1bd)][_0x8987d4(0x1cf)]),_0xd99293[_0x8987d4(0x1bc)]=qs[_0x8987d4(0x1d7)](_[_0x8987d4(0x1b1)](_0x59f70e[_0x8987d4(0x1bd)],_0x55ba04[_0x8987d4(0x1d7)]),_0x4cfe05);_0x59f70e['query']['filter']&&(_0xd99293=filterAttributes(_0xd99293,_0x59f70e[_0x8987d4(0x1bd)][_0x8987d4(0x1d8)],_0xd99293[_0x8987d4(0x1a8)],_0x59f70e['options'],![]));_0xd99293=_['merge']({},_0xd99293,_0x59f70e['options']);const _0x37f030={'where':_0xd99293[_0x8987d4(0x1bc)]};return db[_0x8987d4(0x1d5)]['count'](_0x37f030)['then'](function(_0x42a892){const _0x18bbee=_0x8987d4;return _0x1f2587[_0x18bbee(0x1c2)]=_0x42a892,_0x59f70e['query'][_0x18bbee(0x1a2)]&&(_0xd99293['include']=[{'all':!![]}]),db[_0x18bbee(0x1d5)][_0x18bbee(0x1d0)](_0xd99293);})['then'](function(_0x478107){const _0x316f77=_0x8987d4;return _0x1f2587[_0x316f77(0x1a7)]=_0x478107,_0x1f2587;})[_0x8987d4(0x1a4)](respondWithFilteredResult(_0x11f922,_0xd99293))['catch'](handleError(_0x11f922,null));})['catch'](handleError(_0x11f922,null));},exports[a146_0x5da71c(0x1a9)]=function(_0xd078c9,_0x3d1901){const _0x9edc0e=a146_0x5da71c;let _0x23edc4={'raw':![],'where':{'id':_0xd078c9[_0x9edc0e(0x1da)]['id']}};const _0x19d961={};return _0x19d961['model']=_[_0x9edc0e(0x1c8)](db[_0x9edc0e(0x1d5)][_0x9edc0e(0x1b7)]),_0x19d961[_0x9edc0e(0x1bd)]=_['keys'](_0xd078c9[_0x9edc0e(0x1bd)]),_0x19d961[_0x9edc0e(0x1d7)]=_['intersection'](_0x19d961[_0x9edc0e(0x1a0)],_0x19d961[_0x9edc0e(0x1bd)]),_0x23edc4[_0x9edc0e(0x1a8)]=_['intersection'](_0x19d961[_0x9edc0e(0x1a0)],qs['fields'](_0xd078c9[_0x9edc0e(0x1bd)][_0x9edc0e(0x1ab)])),_0x23edc4[_0x9edc0e(0x1a8)]=_0x23edc4[_0x9edc0e(0x1a8)][_0x9edc0e(0x1b9)]?_0x23edc4['attributes']:_0x19d961[_0x9edc0e(0x1a0)],_0xd078c9[_0x9edc0e(0x1bd)][_0x9edc0e(0x1a2)]&&(_0x23edc4['include']=[{'all':!![]}]),_0x23edc4=_[_0x9edc0e(0x1c9)]({},_0x23edc4,_0xd078c9[_0x9edc0e(0x1ae)]),db['CmCompany'][_0x9edc0e(0x19d)](_0x23edc4)[_0x9edc0e(0x1a4)](handleEntityNotFound(_0x3d1901,null))[_0x9edc0e(0x1a4)](respondWithResult(_0x3d1901,null))[_0x9edc0e(0x1cb)](handleError(_0x3d1901,null));},exports[a146_0x5da71c(0x1bf)]=function(_0xa9533c,_0x4f783b){const _0x1cb2ea=a146_0x5da71c;return db[_0x1cb2ea(0x1d5)]['create'](_0xa9533c[_0x1cb2ea(0x1ba)],{})['then'](function(_0x2b4bc2){const _0x556578=_0x1cb2ea,_0xd4f9a7=_0xa9533c[_0x556578(0x1de)][_0x556578(0x1d3)]({'plain':!![]});if(!_0xd4f9a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd4f9a7[_0x556578(0x1a1)]===_0x556578(0x1de)){const _0x38309f=_0x2b4bc2[_0x556578(0x1d3)]({'plain':!![]}),_0x319973='Companies';return db[_0x556578(0x1d6)][_0x556578(0x19d)]({'where':{'name':_0x319973,'userProfileId':_0xd4f9a7['userProfileId']},'raw':!![]})[_0x556578(0x1a4)](function(_0x4561b0){const _0x4f3839=_0x556578;return _0x4561b0&&_0x4561b0[_0x4f3839(0x19f)]===0x0?db['UserProfileResource'][_0x4f3839(0x1bf)]({'name':_0x38309f[_0x4f3839(0x1db)],'resourceId':_0x38309f['id'],'type':_0x4561b0[_0x4f3839(0x1db)],'sectionId':_0x4561b0['id']},{})[_0x4f3839(0x1a4)](function(){return _0x2b4bc2;}):_0x2b4bc2;})[_0x556578(0x1cb)](function(_0x6847e3){const _0x82beb1=_0x556578;logger['error'](_0x82beb1(0x1e0),_0x6847e3);throw _0x6847e3;});}return _0x2b4bc2;})[_0x1cb2ea(0x1a4)](respondWithResult(_0x4f783b,0xc9))[_0x1cb2ea(0x1cb)](handleError(_0x4f783b,null));},exports['update']=function(_0x192a4a,_0x4e19c9){const _0x2b0f71=a146_0x5da71c;return _0x192a4a[_0x2b0f71(0x1ba)]['id']&&delete _0x192a4a[_0x2b0f71(0x1ba)]['id'],db[_0x2b0f71(0x1d5)][_0x2b0f71(0x19d)]({'where':{'id':_0x192a4a['params']['id']}})['then'](handleEntityNotFound(_0x4e19c9,null))['then'](saveUpdates(_0x192a4a[_0x2b0f71(0x1ba)],null))[_0x2b0f71(0x1a4)](respondWithResult(_0x4e19c9,null))[_0x2b0f71(0x1cb)](handleError(_0x4e19c9,null));},exports[a146_0x5da71c(0x1ac)]=function(_0x578642,_0x222132){const _0x11d319=a146_0x5da71c;return db[_0x11d319(0x1d5)][_0x11d319(0x19d)]({'where':{'id':_0x578642['params']['id']}})[_0x11d319(0x1a4)](handleEntityNotFound(_0x222132,null))[_0x11d319(0x1a4)](removeEntity(_0x222132,null))['catch'](handleError(_0x222132,null));},exports['describe']=function(_0x349fb3,_0x426677){const _0x274bad=a146_0x5da71c;return db[_0x274bad(0x1d5)][_0x274bad(0x1ce)]()[_0x274bad(0x1a4)](respondWithResult(_0x426677,null))[_0x274bad(0x1cb)](handleError(_0x426677,null));},exports[a146_0x5da71c(0x1c6)]=function(_0x160f5a,_0x5c86e0){const _0x2c213d=a146_0x5da71c;return db[_0x2c213d(0x1d9)]['findOne']({'where':{'id':_0x160f5a[_0x2c213d(0x1da)]['id']}})[_0x2c213d(0x1a4)](function(_0x45b581){const _0x2a6914=_0x2c213d;if(_0x45b581)return _0x45b581[_0x2a6914(0x1c6)](_0x160f5a[_0x2a6914(0x1ba)][_0x2a6914(0x1c7)],{'through':_[_0x2a6914(0x1c3)](_0x160f5a[_0x2a6914(0x1ba)],[_0x2a6914(0x1c7),'id'])});})[_0x2c213d(0x1a4)](respondWithResult(_0x5c86e0,null))['catch'](handleError(_0x5c86e0,null));},exports[a146_0x5da71c(0x1b6)]=function(_0x18d8e7,_0x1e5294){const _0x40869d=a146_0x5da71c;let _0x208a69={};const _0x487ad6={};let _0x2e22ba,_0x57dec3;return db[_0x40869d(0x1d5)][_0x40869d(0x19d)]({'where':{'id':_0x18d8e7['params']['id']}})[_0x40869d(0x1a4)](handleEntityNotFound(_0x1e5294,null))[_0x40869d(0x1a4)](function(_0x4ab85f){const _0xcef8e1=_0x40869d;if(_0x4ab85f)return _0x2e22ba=_0x4ab85f,_0x487ad6[_0xcef8e1(0x1a0)]=_[_0xcef8e1(0x1c8)](db[_0xcef8e1(0x1d9)][_0xcef8e1(0x1b7)]),_0x487ad6['query']=_[_0xcef8e1(0x1c8)](_0x18d8e7[_0xcef8e1(0x1bd)]),_0x487ad6['filters']=_['intersection'](_0x487ad6[_0xcef8e1(0x1a0)],_0x487ad6[_0xcef8e1(0x1bd)]),_0x208a69[_0xcef8e1(0x1a8)]=_['intersection'](_0x487ad6[_0xcef8e1(0x1a0)],qs['fields'](_0x18d8e7[_0xcef8e1(0x1bd)]['fields'])),_0x208a69[_0xcef8e1(0x1a8)]=_0x208a69[_0xcef8e1(0x1a8)][_0xcef8e1(0x1b9)]?_0x208a69[_0xcef8e1(0x1a8)]:_0x487ad6[_0xcef8e1(0x1a0)],_0x208a69[_0xcef8e1(0x1ad)]=qs['sort'](_0x18d8e7[_0xcef8e1(0x1bd)][_0xcef8e1(0x1cf)]),_0x208a69[_0xcef8e1(0x1bc)]=qs[_0xcef8e1(0x1d7)](_[_0xcef8e1(0x1b1)](_0x18d8e7['query'],_0x487ad6[_0xcef8e1(0x1d7)])),_0x208a69=filterAttributes(_0x208a69,_0x18d8e7['query'][_0xcef8e1(0x1d8)],_0x208a69[_0xcef8e1(0x1a8)],_0x18d8e7[_0xcef8e1(0x1ae)],![]),_0x2e22ba['getContacts'](_0x208a69);})[_0x40869d(0x1a4)](function(_0x4d40f2){const _0xbd6e0f=_0x40869d;if(_0x4d40f2)return _0x57dec3=_0x4d40f2['length'],typeof _0x18d8e7[_0xbd6e0f(0x1bd)][_0xbd6e0f(0x1b0)]===_0xbd6e0f(0x1c1)&&(_0x208a69[_0xbd6e0f(0x1a6)]=qs[_0xbd6e0f(0x1a6)](_0x18d8e7['query']['limit']),_0x208a69[_0xbd6e0f(0x1bb)]=qs[_0xbd6e0f(0x1bb)](_0x18d8e7[_0xbd6e0f(0x1bd)][_0xbd6e0f(0x1bb)])),_0x2e22ba[_0xbd6e0f(0x1b6)](_0x208a69);})[_0x40869d(0x1a4)](function(_0x4920f5){if(_0x4920f5)return _0x4920f5?{'count':_0x57dec3,'rows':_0x4920f5}:null;})[_0x40869d(0x1a4)](respondWithResult(_0x1e5294,null))[_0x40869d(0x1cb)](handleError(_0x1e5294,null));};
\ No newline at end of file