| 1 | import { and, eq } from "drizzle-orm"; |
| 2 | import { ORPCError } |
| 3 | import { db } |
| 4 | import { servers, subusers |
| 5 | |
| 6 | export async function requireServerAccess |
| 7 | userId: string, |
| 8 | serverId: string, |
| 9 | role: string |
| 10 | ) { |
| 11 | const server = |
| 12 | where: eq(servers |
| 13 | with: { node: true |
| 14 | }); |
| 15 | if (!server) |
| 16 | if (role !== |
| 17 | const sub = |
| 18 | where: and(eq |
| 19 | }); |
| 20 | if (!sub) |
| 21 | } |
| 22 | return server; |
| 23 | } |