(
workspaceId: string,
options?: { includeArchived?: boolean }
)
| 42 | * @returns True if the workspace exists, false otherwise |
| 43 | */ |
| 44 | export async function workspaceExists( |
| 45 | workspaceId: string, |
| 46 | options?: { includeArchived?: boolean } |
| 47 | ): Promise<boolean> { |
| 48 | const { includeArchived = false } = options ?? {} |
| 49 | const [ws] = await db |
| 50 | .select({ id: workspace.id }) |
| 51 | .from(workspace) |
| 52 | .where( |
| 53 | includeArchived |
| 54 | ? eq(workspace.id, workspaceId) |
| 55 | : and(eq(workspace.id, workspaceId), isNull(workspace.archivedAt)) |
| 56 | ) |
| 57 | .limit(1) |
| 58 | |
| 59 | return !!ws |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Get a workspace by ID for existence check |
no test coverage detected