(userId: string)
| 43 | * to the primary when no replica is configured. |
| 44 | */ |
| 45 | export async function isPlatformAdmin(userId: string): Promise<boolean> { |
| 46 | const [row] = await dbReplica |
| 47 | .select({ role: user.role }) |
| 48 | .from(user) |
| 49 | .where(eq(user.id, userId)) |
| 50 | .limit(1) |
| 51 | |
| 52 | return row?.role === 'admin' |
| 53 | } |