/**• 📌 File: userController.js• 📌 Purpose: Handles user authentication & management• 📌 Author: Zach• 📌 Last Modified: 2025-02-04• 📌 Notes: Uses JWT for authentication*/
Headers
/** ======================================= * 🔧 Utility Functions (Helper Methods) * ======================================= * Contains reusable helper functions for * string manipulation, data formatting, etc. */
/** ================================ * 🏗️ User Authentication Functions * ================================ */
Function/Method Descriptions
/** * 🔑 Logs in a user using email and password. * @param {string} email - The user's email address. * @param {string} password - The user's password. * @returns {Promise<string>} - A JWT token if successful. */async function loginUser(email, password) { // Function logic...}
Inline Code
// 🛠️ Hash the password before saving it to the databaseconst hashedPassword = await bcrypt.hash(password, 10);
Temporary or Debugging Notes
// TODO: Optimize this loop for performancefor (let i = 0; i < users.length; i++) { console.log(users[i]); // Debugging output}
Deprecated or Unused Code
// ❌ DEPRECATED: Use the new loginUser() method insteadfunction oldLoginMethod() { console.warn("This function is deprecated.");}