Merge pull request #210 from Mirza-Samad-Ahmed-Baig/main
refactor: improve theme handling, env var safety, and db schema
This commit is contained in:
@ -19,7 +19,7 @@ export default function RootLayout({
|
|||||||
return (
|
return (
|
||||||
<html lang="en" suppressHydrationWarning>
|
<html lang="en" suppressHydrationWarning>
|
||||||
<body className={`${defaultFont.className} font-sans antialiased`}>
|
<body className={`${defaultFont.className} font-sans antialiased`}>
|
||||||
<ThemeProvider attribute="class" forcedTheme="dark" enableSystem>
|
<ThemeProvider attribute="class" enableSystem>
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<StorageProvider>{children}</StorageProvider>
|
<StorageProvider>{children}</StorageProvider>
|
||||||
<Analytics />
|
<Analytics />
|
||||||
|
@ -7,7 +7,7 @@ export const auth = betterAuth({
|
|||||||
provider: "pg",
|
provider: "pg",
|
||||||
usePlural: true,
|
usePlural: true,
|
||||||
}),
|
}),
|
||||||
secret: process.env.BETTER_AUTH_SECRET!,
|
secret: process.env.BETTER_AUTH_SECRET,
|
||||||
user: {
|
user: {
|
||||||
deleteUser: {
|
deleteUser: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
@ -19,11 +19,7 @@ function getDb() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Export a proxy that forwards all calls to the actual db instance
|
// Export a proxy that forwards all calls to the actual db instance
|
||||||
export const db = new Proxy({} as ReturnType<typeof drizzle>, {
|
export const db = getDb();
|
||||||
get(target, prop) {
|
|
||||||
return getDb()[prop as keyof typeof _db];
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// Re-export schema for convenience
|
// Re-export schema for convenience
|
||||||
export * from "./schema";
|
export * from "./schema";
|
||||||
|
@ -5,7 +5,7 @@ export const users = pgTable("users", {
|
|||||||
name: text("name").notNull(),
|
name: text("name").notNull(),
|
||||||
email: text("email").notNull().unique(),
|
email: text("email").notNull().unique(),
|
||||||
emailVerified: boolean("email_verified")
|
emailVerified: boolean("email_verified")
|
||||||
.$defaultFn(() => false)
|
.default(false)
|
||||||
.notNull(),
|
.notNull(),
|
||||||
image: text("image"),
|
image: text("image"),
|
||||||
createdAt: timestamp("created_at")
|
createdAt: timestamp("created_at")
|
||||||
|
Reference in New Issue
Block a user