Open AdamJessop opened 2 years ago
Re: issue https://github.com/needle-innovision/nestjs-tenancy/issues/27
Allow the tenantId to be optional.
Added forceCheck to the module options (default false) to state if the tenant should be checked on initialisation or not.
forceCheck
Added an TenantGuard to be able to specify if a route needs a tenant or not.
Notes:
Validator will not run if forceCheck is false and tenantId isn't defined.
TENANT_CONTEXT or other provided tokens may be undefined if the tenant isn't specified, so protect against them / sanity check them.
use the guard with: @UseGuards(TenantGuard)
@UseGuards(TenantGuard)
@AdamJessop Thanks a lot for this PR. Just to be sure could you also add few test cases to support your PR usage. Will update the docs accordingly after that.
Re: issue https://github.com/needle-innovision/nestjs-tenancy/issues/27
Allow the tenantId to be optional.
Added
forceCheck
to the module options (default false) to state if the tenant should be checked on initialisation or not.Added an TenantGuard to be able to specify if a route needs a tenant or not.
Notes:
Validator will not run if
forceCheck
is false and tenantId isn't defined.TENANT_CONTEXT or other provided tokens may be undefined if the tenant isn't specified, so protect against them / sanity check them.
use the guard with:
@UseGuards(TenantGuard)