refactor: improve theme handling, env var safety, and db schema

This commit is contained in:
Mirza-Samad-Ahmed-Baig
2025-07-12 13:31:50 +05:00
parent fd017d6aca
commit d48a3fe287
4 changed files with 4 additions and 8 deletions

View File

@ -7,7 +7,7 @@ export const auth = betterAuth({
provider: "pg",
usePlural: true,
}),
secret: process.env.BETTER_AUTH_SECRET!,
secret: process.env.BETTER_AUTH_SECRET,
user: {
deleteUser: {
enabled: true,

View File

@ -19,11 +19,7 @@ function getDb() {
}
// Export a proxy that forwards all calls to the actual db instance
export const db = new Proxy({} as ReturnType<typeof drizzle>, {
get(target, prop) {
return getDb()[prop as keyof typeof _db];
},
});
export const db = getDb();
// Re-export schema for convenience
export * from "./schema";

View File

@ -5,7 +5,7 @@ export const users = pgTable("users", {
name: text("name").notNull(),
email: text("email").notNull().unique(),
emailVerified: boolean("email_verified")
.$defaultFn(() => false)
.default(false)
.notNull(),
image: text("image"),
createdAt: timestamp("created_at")