fix: correct req.user property from id to userId in controllers

This commit is contained in:
2026-02-02 00:58:35 -06:00
parent 203e6069c8
commit d25ec6ebe7
3 changed files with 4 additions and 4 deletions

View File

@@ -89,7 +89,7 @@ export async function getById(req: Request, res: Response): Promise<void> {
*/
export async function create(req: AuthenticatedRequest, res: Response): Promise<void> {
try {
const userId = req.user?.id;
const userId = req.user?.userId;
if (!userId) {
res.status(401).json({

View File

@@ -81,7 +81,7 @@ export async function getById(req: Request, res: Response): Promise<void> {
*/
export async function create(req: AuthenticatedRequest, res: Response): Promise<void> {
try {
const userId = req.user?.id;
const userId = req.user?.userId;
if (!userId) {
res.status(401).json({

View File

@@ -254,7 +254,7 @@ export async function deleteUser(
}
// Prevent admin from deleting themselves
if (req.user?.id === userId) {
if (req.user?.userId === userId) {
res.status(400).json({
success: false,
error: 'Cannot deactivate your own account',
@@ -305,7 +305,7 @@ export async function changePassword(
}
// Only allow users to change their own password
if (req.user?.id !== userId) {
if (req.user?.userId !== userId) {
res.status(403).json({
success: false,
error: 'You can only change your own password',