feat(auth) : sync Sudloh profiles and validate sessions

This commit is contained in:
2026-10-06 00:48:29 +07:00 Unverified
parent d6153be50d
commit c856904c12
16 changed files with 520 additions and 32 deletions
+2 -3
View File
@@ -1,7 +1,6 @@
import "server-only";
import { headers } from "next/headers";
import { getAuth } from "@/lib/auth/server";
import { getVerifiedSession } from "@/lib/auth/server";
import { getDb } from "@/db";
import { users } from "@/db/schema";
import { eq } from "drizzle-orm";
@@ -9,7 +8,7 @@ import { HttpError } from "@/lib/security/http";
import { getRedisClient, redisEventChannel } from "@/lib/redis/client";
export async function requireCommissionUser() {
const session = await getAuth().api.getSession({ headers: await headers() });
const session = await getVerifiedSession();
if (!session?.user) throw new HttpError(401, "unauthorized");
const [user] = await getDb().select().from(users).where(eq(users.id, session.user.id)).limit(1);
if (!user || user.banned) throw new HttpError(401, "unauthorized");