MCPcopy Index your code
hub / github.com/simstudioai/sim / isOrganizationBillingBlocked

Function isOrganizationBillingBlocked

apps/sim/lib/billing/core/access.ts:90–112  ·  view source on GitHub ↗
(organizationId: string)

Source from the content-addressed store, hash-verified

88}
89
90export async function isOrganizationBillingBlocked(organizationId: string): Promise<boolean> {
91 const [owner] = await db
92 .select({ userId: member.userId })
93 .from(member)
94 .where(and(eq(member.organizationId, organizationId), eq(member.role, 'owner')))
95 .limit(1)
96
97 if (!owner) {
98 logger.error(
99 'Organization has no owner when checking billing-blocked state — data integrity issue',
100 { organizationId }
101 )
102 return false
103 }
104
105 const [ownerStats] = await db
106 .select({ blocked: userStats.billingBlocked })
107 .from(userStats)
108 .where(eq(userStats.userId, owner.userId))
109 .limit(1)
110
111 return !!ownerStats?.blocked
112}

Calls 2

errorMethod · 0.80
eqFunction · 0.50

Tested by

no test coverage detected