( organizationId: string, reason: BillingBlockReason )
| 121 | * Returns the number of members actually unblocked |
| 122 | */ |
| 123 | export async function unblockOrgMembers( |
| 124 | organizationId: string, |
| 125 | reason: BillingBlockReason |
| 126 | ): Promise<number> { |
| 127 | const memberIds = await getOrgMemberIds(organizationId) |
| 128 | |
| 129 | if (memberIds.length === 0) { |
| 130 | return 0 |
| 131 | } |
| 132 | |
| 133 | const result = await db |
| 134 | .update(userStats) |
| 135 | .set({ billingBlocked: false, billingBlockedReason: null }) |
| 136 | .where(and(inArray(userStats.userId, memberIds), eq(userStats.billingBlockedReason, reason))) |
| 137 | .returning({ userId: userStats.userId }) |
| 138 | |
| 139 | return result.length |
| 140 | } |
| 141 | |
| 142 | export interface RestoreProResult { |
| 143 | restored: boolean |
no test coverage detected