(userId: User['id'])
| 139 | }) |
| 140 | .from(organization_memberships) |
| 141 | .innerJoin(organizations, eq(organizations.id, organization_memberships.organization_id)) |
| 142 | .where( |
| 143 | and(eq(organization_memberships.kilo_user_id, userId), isNull(organizations.deleted_at)) |
| 144 | ); |
| 145 | return rows; |
| 146 | } |
| 147 | |
| 148 | export async function userHasOrganizations(userId: User['id']): Promise<boolean> { |
| 149 | const result = await db |
| 150 | .select({ id: organization_memberships.id }) |
| 151 | .from(organization_memberships) |
| 152 | .innerJoin(organizations, eq(organizations.id, organization_memberships.organization_id)) |
| 153 | .where(and(eq(organization_memberships.kilo_user_id, userId), isNull(organizations.deleted_at))) |
no test coverage detected