feat(db): add users/currency/bans/settings read repositories

This commit is contained in:
2026-06-27 14:34:59 +02:00
parent 3e3776b477
commit d04ed42586
7 changed files with 76 additions and 0 deletions
@@ -0,0 +1,20 @@
import { eq } from "drizzle-orm";
import type { Database } from "../client.js";
import { users } from "../schema/users.js";
export function makeUsersRepo(db: Database) {
return {
findById: async (id: number) => {
const rows = await db.select().from(users).where(eq(users.id, id)).limit(1);
return rows[0] ?? null;
},
findByUsername: async (username: string) => {
const rows = await db
.select()
.from(users)
.where(eq(users.username, username))
.limit(1);
return rows[0] ?? null;
},
};
}