From 4f47d29348b82c1fc7fc9ec2ff76de65c0782586 Mon Sep 17 00:00:00 2001 From: Kristopher Santos Date: Sun, 20 Jul 2025 22:19:12 +0800 Subject: [PATCH 1/2] Important Update!!! Commit now! --- backend/app/controllers/chat_controller.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/backend/app/controllers/chat_controller.ts b/backend/app/controllers/chat_controller.ts index 4128a47..78bd763 100644 --- a/backend/app/controllers/chat_controller.ts +++ b/backend/app/controllers/chat_controller.ts @@ -35,12 +35,8 @@ export default class ChatController { description: 'Successfully retrieved all chats associated with the authenticated user.', type: [Chat], }) - async index({ response, request }: HttpContext) { - const id = request.auth.user?.userId - - const chats = await ChatModel.find({ userId: id }).sort({ updatedAt: -1 }) - - return response.ok(chats) + async index({ response }: HttpContext) { + return response.ok('Hello') } /** From 17814eb5fe70c69f53e03ce9888ec9f904239bd9 Mon Sep 17 00:00:00 2001 From: Kristopher Santos Date: Sun, 20 Jul 2025 22:21:24 +0800 Subject: [PATCH 2/2] Fix to the error --- backend/app/controllers/chat_controller.ts | 8 ++++++-- frontend/app/login/login-form.tsx | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/app/controllers/chat_controller.ts b/backend/app/controllers/chat_controller.ts index 78bd763..4128a47 100644 --- a/backend/app/controllers/chat_controller.ts +++ b/backend/app/controllers/chat_controller.ts @@ -35,8 +35,12 @@ export default class ChatController { description: 'Successfully retrieved all chats associated with the authenticated user.', type: [Chat], }) - async index({ response }: HttpContext) { - return response.ok('Hello') + async index({ response, request }: HttpContext) { + const id = request.auth.user?.userId + + const chats = await ChatModel.find({ userId: id }).sort({ updatedAt: -1 }) + + return response.ok(chats) } /** diff --git a/frontend/app/login/login-form.tsx b/frontend/app/login/login-form.tsx index 3e07b3c..3010287 100644 --- a/frontend/app/login/login-form.tsx +++ b/frontend/app/login/login-form.tsx @@ -58,7 +58,7 @@ function LoginForm() { {type === "login" && ( - Welcome back! + Welcome back tol! Do not have an account yet?{" "}