import { eq } from "drizzle-orm";
import { usersTable } from "../databaseSchema";
import { db } from "../db";
export type User = NonNullable<Awaited<ReturnType<typeof users.get>>>;
export const users = {
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
get: async (username: string) => {
const rows = await db
.select({
id: usersTable.id,
username: usersTable.username,
passwordHash: usersTable.passwordHash,
})
.from(usersTable)
.where(eq(usersTable.username, username))
.limit(1);
return rows[0];
},
};
import { eq } from "drizzle-orm";
import { usersTable } from "../databaseSchema";
import { db } from "../db";
export type User = NonNullable<Awaited<ReturnType<typeof users.get>>>;
export const users = {
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
get: async (username: string) => {
const rows = await db
.select({
id: usersTable.id,
username: usersTable.username,
passwordHash: usersTable.passwordHash,
})
.from(usersTable)
.where(eq(usersTable.username, username))
.limit(1);
return rows[0];
},
};