feat: add getAllUsers function and integrate user fetching in dashboard

This commit is contained in:
2025-06-30 20:23:08 +02:00
parent c165a0f71b
commit 0bae4d3c01
3 changed files with 104 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import mysql from "mysql2";
import dotenv from "dotenv";
import { error } from "console";
dotenv.config();
// Create a MySQL connection pool using environment variables for configuration
@@ -130,3 +131,12 @@ export async function deleteUser(
}
} catch (err) {}
}
export async function getAllUsers() {
try {
const [data] = await pool.query("SELECT * FROM users;");
return { result: data, success: true };
} catch (err) {
return { result: err, success: false };
}
}