( stripeCustomerId: string, )
| 29 | * Look up a user by their Stripe customer ID. |
| 30 | */ |
| 31 | export async function getUserByStripeCustomerId( |
| 32 | stripeCustomerId: string, |
| 33 | ): Promise<{ |
| 34 | id: string |
| 35 | banned: boolean |
| 36 | email: string |
| 37 | name: string | null |
| 38 | } | null> { |
| 39 | const users = await db |
| 40 | .select({ |
| 41 | id: schema.user.id, |
| 42 | banned: schema.user.banned, |
| 43 | email: schema.user.email, |
| 44 | name: schema.user.name, |
| 45 | }) |
| 46 | .from(schema.user) |
| 47 | .where(eq(schema.user.stripe_customer_id, stripeCustomerId)) |
| 48 | .limit(1) |
| 49 | |
| 50 | return users[0] ?? null |
| 51 | } |
no test coverage detected