phase 1-6 implemented

This commit is contained in:
dimitar committed 2026-03-10 04:14:03 +01:00
1 parent 22c274bb83
commit 2c4927478a
73 files changed
+9702 -2354

No files matched your search

+7 -4
View File
@@ -1,5 +1,6 @@
import { auth, currentUser } from "@clerk/nextjs/server";
import { NextRequest } from "next/server";
import log from "./logger";
/**
* Get authenticated user ID from request
@@ -15,19 +16,21 @@ export async function getAuthUserId(req: NextRequest): Promise<string | null> {
const { userId } = await auth();
if (userId) {
console.log("✓ Authenticated user:", userId);
log.debug("Authenticated user", { userId });
return userId;
}
console.log("✗ No authentication found");
log.debug("No authentication found");
// Log headers for debugging
const authHeader = req.headers.get("authorization");
console.log("Authorization header:", authHeader ? "Present" : "Missing");
log.debug("Authorization header check", {
present: !!authHeader,
});
return null;
} catch (error) {
console.error("Authentication error:", error);
log.error("Authentication error", error);
return null;
}
}