Open ephrimlawrence opened 2 years ago
Fix for #27
This PR adds skipTenantCheck option to TenancyModuleOptions. If skipTenantCheck is true for a request, tenant database connection will be bypassed.
skipTenantCheck
TenancyModuleOptions
As in the example below, the tenant DB connection will be bypassed for all /birds* routes.
/birds*
TenancyModule.forRoot({ tenantIdentifier: 'X-TenantId', options: {}, uri: (tenantId: string) => `mongodb://localhost/tenant-${tenantId}`, skipTenantCheck: (req) => req.route.path.match(/^\/birds*/) != null, })
@sandeepsuvit any feedback on this PR? We really need the optional tenancy check feature
Hi @ephrimlawrence the reason why i kept it on hold is because of difference of opinions on this implementation. Please refer to the following comment
Also there is another PR pending with similar functionality but using a guard implementation.
guard
Please let me know your viewpoint on these.
This is very good feature.! any thing you can do this to merge ? @sandeepsuvit
Fix for #27
This PR adds
skipTenantCheck
option toTenancyModuleOptions
. IfskipTenantCheck
is true for a request, tenant database connection will be bypassed.As in the example below, the tenant DB connection will be bypassed for all
/birds*
routes.