(sub: { referenceId: string })
| 95 | * `isOrgScopedSubscription(sub, userId)` is cheaper and equally correct. |
| 96 | */ |
| 97 | export async function isSubscriptionOrgScoped(sub: { referenceId: string }): Promise<boolean> { |
| 98 | const rows = await db |
| 99 | .select({ id: organization.id }) |
| 100 | .from(organization) |
| 101 | .where(eq(organization.id, sub.referenceId)) |
| 102 | .limit(1) |
| 103 | return rows.length > 0 |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Aggregate raw pooled stats for all members of an organization in a single |
no test coverage detected