How can you implement multi-tenant access to data?
cleverid opened this issue · 0 comments
cleverid commented
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