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

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

@cleverid

Description

@cleverid

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions