From d4167698d7e725e4dfcb6bdd188d100d8ed90550 Mon Sep 17 00:00:00 2001 From: "codetector-ai[bot]" <221859081+codetector-ai[bot]@users.noreply.github.com> Date: Mon, 1 Sep 2025 18:23:45 +0000 Subject: [PATCH 1/2] Debugs --- src/controllers/Chat/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controllers/Chat/index.ts b/src/controllers/Chat/index.ts index 6eb81cd..654b465 100644 --- a/src/controllers/Chat/index.ts +++ b/src/controllers/Chat/index.ts @@ -7,7 +7,8 @@ import {User} from '../../models/userModel'; export const createChat = async (req: Request, res: Response) => { try { const { name } = req.body; - const userId = req.user?._id; // Assuming user ID is available in req.user + const userId = req.user?._id; // Assuming user ID is available in req.user + console.log(userId) if (!userId) { return res.status(401).json({ message: 'User not authenticated' }); From 8df0b763028d167af4fd1dbf4281974e65dedc22 Mon Sep 17 00:00:00 2001 From: Shivang Yadav <125182653+shivang-16@users.noreply.github.com> Date: Sun, 2 Nov 2025 13:04:16 +0530 Subject: [PATCH 2/2] Update src/controllers/Chat/index.ts Co-authored-by: beetles-ai[bot] <221859081+beetles-ai[bot]@users.noreply.github.com> --- src/controllers/Chat/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controllers/Chat/index.ts b/src/controllers/Chat/index.ts index 654b465..f7c83d2 100644 --- a/src/controllers/Chat/index.ts +++ b/src/controllers/Chat/index.ts @@ -8,7 +8,8 @@ export const createChat = async (req: Request, res: Response) => { try { const { name } = req.body; const userId = req.user?._id; // Assuming user ID is available in req.user - console.log(userId) +const userId = req.user?._id; // Assuming user ID is available in req.user +if (!userId) { if (!userId) { return res.status(401).json({ message: 'User not authenticated' });