Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

How can you implement multi-tenant access to data? #155

Open
cleverid opened this issue Oct 24, 2023 · 0 comments
Open

How can you implement multi-tenant access to data? #155

cleverid opened this issue Oct 24, 2023 · 0 comments

Comments

@cleverid
Copy link

After authorization, the user with his tenant_id makes a request to the database.

How to make it so as not to add this tenant_id manually to the where section?

From ORM query:

    const users = await orm
      .select()
      .from(userSchema)
      .where(eq(userSchema.tenant_id, this.tenant_id)); // Users for tenant_id. Filter added as handly

To:

    const users = await orm
      .select()
      .from(userSchema) // But the request has tenant_id as a result of the SQL query
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant