From 8c1b9e654d9348cf47a5df2f01401a9500cb4af8 Mon Sep 17 00:00:00 2001 From: anshul23102 Date: Tue, 2 Jun 2026 22:50:42 +0530 Subject: [PATCH] fix(auth): persist current_year in student signup User.create call Fixes #277 The student signup path validated current_year (checking it is between 1 and 6) but never included the field in the student_bio object passed to User.create. Every student account was stored with current_year as undefined even though the client submitted a value and the schema supports the field. Added current_year: Number(req.body.current_year) to the student_bio object so the validated value is written to the database. --- backend/controllers/auth.controller.js | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/controllers/auth.controller.js b/backend/controllers/auth.controller.js index 7dd531f..f6f8c79 100644 --- a/backend/controllers/auth.controller.js +++ b/backend/controllers/auth.controller.js @@ -131,6 +131,7 @@ async function signup(req, res, next) { student_bio: { gender: req.body.gender || 'male', enrollment_year: req.body.enrollment_year || new Date().getFullYear(), + current_year: Number(req.body.current_year), course: course_id, roll_number: req.body.roll_number || null, avatar: ''