Refactor API routes and enhance documentation; add collaboration features and user role management. Update environment example and improve error handling in authentication.

This commit is contained in:
2025-07-18 16:34:25 -04:00
parent 2dcd2a2832
commit 28ac7dd9e0
23 changed files with 7439 additions and 157 deletions

View File

@@ -1,16 +1,10 @@
import { DrizzleAdapter } from "@auth/drizzle-adapter";
import { type DefaultSession, type NextAuthConfig } from "next-auth";
import Credentials from "next-auth/providers/credentials";
import bcrypt from "bcryptjs";
import { eq } from "drizzle-orm";
import { db } from "~/server/db";
import {
accounts,
sessions,
users,
verificationTokens,
} from "~/server/db/schema";
import { users } from "~/server/db/schema";
/**
* Module augmentation for `next-auth` types. Allows us to add custom properties to the `session`
@@ -55,7 +49,7 @@ export const authConfig = {
where: eq(users.email, credentials.email as string),
});
if (!user || !user.password) {
if (!user?.password) {
return null;
}