Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make tenantId optional #29

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AdamJessop
Copy link

@AdamJessop AdamJessop commented Jun 24, 2022

Re: issue #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)

@sandeepsuvit
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants