(userId: string)
| 366 | } |
| 367 | |
| 368 | async function countNonOrganizationOwnedWorkspaces(userId: string): Promise<number> { |
| 369 | const [result] = await db |
| 370 | .select({ value: count() }) |
| 371 | .from(workspace) |
| 372 | .where(and(eq(workspace.ownerId, userId), isNull(workspace.organizationId))) |
| 373 | |
| 374 | return result?.value ?? 0 |
| 375 | } |
| 376 | |
| 377 | /** |
| 378 | * Returns the userId of the organization owner, or `null` if the |
no test coverage detected