added prize draw name to tables

This commit is contained in:
2026-06-03 16:29:45 +02:00
parent f7a0a3753c
commit a66b150d97
11 changed files with 91 additions and 29 deletions
+14 -5
View File
@@ -3,24 +3,33 @@ import dotenv from "dotenv";
const router = express.Router();
dotenv.config();
import { getUser, newEntry, confirmUser } from "./frontend.data.js";
import { getInfo, newEntry, confirmUser } from "./frontend.data.js";
router.post("/new-entry", async (req, res) => {
const username = req.query.username;
const result = await newEntry(req.body, username);
const draw = req.query.draw;
const result = await newEntry(req.body, username, draw);
if (!result.success) {
return res.status(500).json({ message: "Form Data Invalid" });
}
res.sendStatus(204);
});
router.get("/users", async (req, res) => {
const users = await getUser();
res.json(users);
router.get("/info", async (req, res) => {
const info = await getInfo();
if (!info) {
return res.status(500).json({ message: "Server error" });
}
res.json(info);
});
router.get("/confirm-user", async (req, res) => {
const username = req.query.username;
if (!username) {
return res.status(400).json({ message: "Username is required" });
}