feat: update user retrieval and add new users table; enhance MainForm with user fetching and localization support
This commit is contained in:
@@ -12,14 +12,14 @@ const pool = mysql
|
||||
.promise();
|
||||
|
||||
export const getUser = async () => {
|
||||
const [rows] = await pool.query("SELECT unique_key FROM users");
|
||||
const [rows] = await pool.query("SELECT username FROM usersNEW");
|
||||
|
||||
if (rows.length > 0) {
|
||||
return {rows};
|
||||
const users = rows.map((r) => r.username);
|
||||
return { users };
|
||||
} else {
|
||||
return { message: "No data found" };
|
||||
return { users: [], message: "No data found" };
|
||||
}
|
||||
};
|
||||
|
||||
export const confirmData = async (data) => {
|
||||
|
||||
}
|
||||
export const confirmData = async (data) => {};
|
||||
|
||||
@@ -16,4 +16,9 @@ router.post("/frontend", async (req, res) => {
|
||||
res.sendStatus(204);
|
||||
});
|
||||
|
||||
router.get("/users", async (req, res) => {
|
||||
const users = await getUser();
|
||||
res.json(users);
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -8,6 +8,14 @@ CREATE TABLE users (
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE usersNEW (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
username VARCHAR(100) NOT NULL UNIQUE,
|
||||
first_name VARCHAR(100) NOT NULL,
|
||||
last_name VARCHAR(100) NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Trigger zur automatischen Generierung eines 25‑stelligen Keys
|
||||
DELIMITER $
|
||||
|
||||
|
||||
Reference in New Issue
Block a user