Prevent duplicate tenant memberships on import
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 37s
Build and Push Docker Images / build-frontend (push) Successful in 1m18s
Build and Push Docker Images / build-website (push) Successful in 17s
Build and Push Docker Images / build-docs (push) Successful in 16s

This commit is contained in:
2026-07-20 19:06:01 +02:00
parent 720c70845e
commit 37d08ee984
4 changed files with 119 additions and 4 deletions

View File

@@ -69,7 +69,9 @@ export default async function meRoutes(server: FastifyInstance) {
.innerJoin(tenants, eq(authTenantUsers.tenant_id, tenants.id))
.where(eq(authTenantUsers.user_id, userId))
const tenantList = tenantRows ?? []
const tenantList = Array.from(
new Map((tenantRows ?? []).map((tenant) => [tenant.id, tenant])).values()
)
// ----------------------------------------------------
// 3) ACTIVE TENANT