Migrate banned users fetching to Kysely

This commit is contained in:
Kalle
2025-11-01 15:03:54 +02:00
parent 7b28ce3877
commit 933902810d
7 changed files with 330 additions and 46 deletions

View File

@@ -247,6 +247,22 @@ export function forcePatron(args: {
.execute();
}
export async function allBannedUsers() {
const rows = await db
.selectFrom("User")
.select(["User.id as userId", "User.banned", "User.bannedReason"])
.where("User.banned", "!=", 0)
.execute();
const result: Map<number, (typeof rows)[number]> = new Map();
for (const row of rows) {
result.set(row.userId, row);
}
return result;
}
export function banUser({
userId,
banned,