Files
IYLaw-Site/server/models/users.js
2025-07-15 13:34:30 -04:00

23 lines
576 B
JavaScript

import db from "./db.js";
/** @typedef User
* @property {number} id - The unique identifier for the user.
* @property {string} username - The username of the user.
* @property {string} password - The hashed password of the user.
*/
/**
* Fetches all users from the database.
* @return {Promise<User[]>}
*/
const getAllUsers = async () => {
try {
return await db.query('SELECT * FROM users').then((users) => users);
} catch (error) {
console.error('Error fetching users:', error);
throw error;
}
}
export default {
getAllUsers
}