59 Commits

Author SHA1 Message Date
theis.gaedigk 9dd9ccebdd changed docker notes 2026-05-20 13:15:33 +02:00
theis.gaedigk 92605d85c2 Merge branch 'dev' into prod 2026-05-20 13:14:47 +02:00
theis.gaedigk 101bd5c060 edited wg-easy 2026-05-20 13:14:28 +02:00
theis.gaedigk 59a1ae51fa deleted unused compose 2026-05-20 13:10:11 +02:00
theis.gaedigk 80a3d4d464 changed ports again 2026-05-20 13:08:05 +02:00
theis.gaedigk 9efb93c37c changed docker config 2026-05-20 13:05:03 +02:00
theis.gaedigk cf638dc42d changed ports again 2026-05-20 12:51:13 +02:00
theis.gaedigk 65092b57d9 changed ports 2026-05-20 12:50:22 +02:00
theis.gaedigk 7045317fc6 reformatted compose 2026-05-20 12:46:50 +02:00
theis.gaedigk 0f75f55ac4 edited wg service 2026-05-20 12:45:59 +02:00
theis.gaedigk 2d2dc52012 changed docker compose 2026-05-20 12:39:08 +02:00
theis.gaedigk 566437bd71 changed port config 2026-05-20 10:49:03 +02:00
theis.gaedigk 266ee1af80 changed docker-compose 2026-05-20 10:41:11 +02:00
theis.gaedigk 43f8e00968 Merge branch 'dev' into prod 2026-05-20 10:39:43 +02:00
theis.gaedigk f32931ded3 added wg-easy 2026-05-20 10:38:25 +02:00
theis.gaedigk 4ce1817bd0 added wg-easy 2026-05-20 10:37:31 +02:00
theis.gaedigk 11c2372cae outsourced modals 2026-05-19 21:54:02 +02:00
theis.gaedigk d5b6c9665c added new warning 2026-05-18 23:23:43 +02:00
theis.gaedigk ce2d0bb329 noted out 3sec pause 2026-05-18 20:41:35 +02:00
theis.gaedigk 5c43b817a7 Merge branch 'dev' into prod 2026-05-18 20:37:04 +02:00
theis.gaedigk c25ab48880 fully implemented tanstack query 2026-05-18 19:14:48 +02:00
theis.gaedigk 8932f5d004 changed code formatting 2026-05-18 18:11:46 +02:00
theis.gaedigk 3832aca12c implemented tanstack query 2026-05-18 18:05:05 +02:00
theis.gaedigk 0953847f24 Merge branch 'dev' into prod 2026-05-10 21:08:23 +02:00
theis.gaedigk 9e7fc530b5 Merge branch 'dev' into prod 2026-05-10 21:05:13 +02:00
theis.gaedigk 18777e5f7c added allowed ips 2026-05-09 23:10:47 +02:00
theis.gaedigk b55129dfff closed ports 2026-05-09 23:06:17 +02:00
theis.gaedigk 26856ee1df edited 2026-05-09 23:03:56 +02:00
theis.gaedigk dd1d8d8d6b edited network config 2026-05-09 21:52:39 +02:00
theis.gaedigk cf2df0aaac edited code design 2026-05-09 21:46:01 +02:00
theis.gaedigk 1199d6468f noted out public web-ui port 2026-05-09 21:45:19 +02:00
theis.gaedigk 7cd958c31e edited ip adresses 2026-05-09 21:43:12 +02:00
theis.gaedigk f89cf84a38 edited docker config 2026-05-09 21:38:56 +02:00
theis.gaedigk e3fc1d8659 edited again 2026-05-09 21:30:59 +02:00
theis.gaedigk 060f8d01c6 edited again 2026-05-09 21:27:47 +02:00
theis.gaedigk 667609d70c fixed docker config 2026-05-09 21:24:42 +02:00
theis.gaedigk b05f19acd9 edited docker compose 2026-05-09 21:22:28 +02:00
theis.gaedigk 2aa9a968f5 Merge branch 'dev' into prod 2026-05-04 22:40:33 +02:00
theis.gaedigk e42a2f510a edited docker compose 2026-05-04 22:05:18 +02:00
theis.gaedigk d2b22fc71f Merge branch 'dev' into prod 2026-05-04 22:04:26 +02:00
theis.gaedigk 471c0c7a49 Merge branch 'dev' into prod 2026-01-21 16:33:03 +01:00
theis.gaedigk 75ff65e76b Merge branch 'dev' into prod 2026-01-21 16:28:23 +01:00
theis.gaedigk 7cf1245ef6 Merge branch 'dev' into prod 2026-01-21 14:27:37 +01:00
theis.gaedigk 2adbfa75a5 Merge branch 'dev' into prod 2026-01-21 14:07:26 +01:00
theis.gaedigk 216a1cb1d4 Merge branch 'dev' into prod 2026-01-20 20:43:59 +01:00
theis.gaedigk 7fc98d6c9f Merge branch 'dev' into prod 2026-01-20 20:34:52 +01:00
theis.gaedigk e346cf9445 e 2026-01-20 20:33:41 +01:00
theis.gaedigk c030b6dbe6 Merge branch 'dev' into prod 2026-01-20 20:33:31 +01:00
theis.gaedigk 6f26b9bbc3 e 2026-01-20 20:22:59 +01:00
theis.gaedigk a34a70572f edited 2026-01-20 20:19:12 +01:00
theis.gaedigk 4b3c8a2424 edited compose file 2026-01-20 20:17:53 +01:00
theis.gaedigk 568b3bf495 edited 2026-01-20 20:08:14 +01:00
theis.gaedigk 5653d32857 fix: update WireGuard PASSWORD_HASH to a static value 2026-01-20 20:06:44 +01:00
theis.gaedigk 7cf5b8df48 Merge branch 'dev' into prod 2026-01-20 20:03:51 +01:00
theis.gaedigk 65c5fc0f8f Merge branch 'dev' into prod 2026-01-20 19:59:27 +01:00
theis.gaedigk b626a67907 Merge branch 'dev' into prod 2026-01-20 19:46:56 +01:00
theis.gaedigk 6643a176a6 Merge branch 'dev' into prod 2026-01-20 19:43:53 +01:00
theis.gaedigk 89803754a7 Merge branch 'dev' into prod 2026-01-20 19:38:27 +01:00
theis.gaedigk 5052b3e83a changed fetch urls 2026-01-20 19:23:53 +01:00
18 changed files with 400 additions and 202 deletions
+3
View File
@@ -0,0 +1,3 @@
[submodule "wg-easy-ca-lose"]
path = wg-easy-ca-lose
url = https://git.the1s.de/theis.gaedigk/wg-easy-ca-lose.git
+5 -4
View File
@@ -28,6 +28,9 @@ export const confirmUser = async (username) => {
]);
if (rows.length > 0) {
const { first_name, last_name } = rows[0];
const fullname = first_name + " " + last_name;
// creating userTicketTable
const d = new Date();
@@ -37,8 +40,6 @@ export const confirmUser = async (username) => {
const date = `${day}_${month}_${year}`;
const tableName = `${username}_${date}`;
console.log(tableName);
const [createTable] = await pool.query(
`CREATE TABLE IF NOT EXISTS ?? (
id INT AUTO_INCREMENT PRIMARY KEY,
@@ -70,9 +71,9 @@ export const confirmUser = async (username) => {
nextID = rows.length > 0 ? rows[0].id + 1 : 1;
};
await getNextID();
return { success: true, nextID, tableName };
return { success: true, nextID, tableName, fullname };
} else {
return { success: false, message: "Table creation failed" };
return { success: false, message: "Table creation failed", fullname };
}
} else {
return null;
-2
View File
@@ -11,8 +11,6 @@ router.post("/new-entry", async (req, res) => {
if (!result.success) {
return res.status(500).json({ message: "Form Data Invalid" });
}
console.log(req.body);
console.log(username);
res.sendStatus(204);
});
+73 -13
View File
@@ -1,16 +1,19 @@
services:
# frontend:
# container_name: ca-lose-frontend
# build: ./frontend
# ports:
# - "8002:80"
# restart: unless-stopped
frontend:
container_name: ca-lose-frontend
hostname: lose-verkaufen
build: ./frontend
depends_on:
- backend
networks:
ca-lose-internal:
ipv4_address: 172.25.0.2
restart: unless-stopped
backend:
container_name: ca-lose-backend
hostname: backend
build: ./backend
ports:
- "8004:8004"
environment:
NODE_ENV: production
DB_HOST: ca-lose-mysql
@@ -19,21 +22,78 @@ services:
DB_NAME: ca_lose
depends_on:
- database
networks:
ca-lose-internal:
ipv4_address: 172.25.0.3
restart: unless-stopped
database:
container_name: ca-lose-mysql
hostname: database
image: mysql:8.0
restart: unless-stopped
ports:
- "3311:3306"
environment:
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_DATABASE: ca_lose
TZ: Europe/Berlin
volumes:
- ca-lose_mysql:/var/lib/mysql
- ../docker/volumes/ca-lose_mysql:/var/lib/mysql
- ./mysql-timezone.cnf:/etc/mysql/conf.d/timezone.cnf:ro
networks:
ca-lose-internal:
ipv4_address: 172.25.0.4
volumes:
ca-lose_mysql:
# DNS Server for hostname resolution within the Docker network
dnsmasq:
container_name: ca-lose-dns
image: andyshinn/dnsmasq:latest
restart: unless-stopped
cap_add:
- NET_ADMIN
command: >
--no-daemon
--log-queries
--address=/lose-verkaufen/172.25.0.2
--address=/frontend/172.25.0.2
--address=/backend/172.25.0.3
--address=/database/172.25.0.4
--address=/wireguard/172.25.0.6
networks:
ca-lose-internal:
ipv4_address: 172.25.0.5
# WireGuard VPN server for secure remote access to the Docker network
wireguard:
build: ./wg-easy-ca-lose
container_name: ca-lose-wireguard
cap_add:
- NET_ADMIN
- SYS_MODULE
environment:
WG_HOST: dus3.the1s.de
INSECURE: "true"
HOST: "172.25.0.6"
PORT: "80"
volumes:
- ../docker/volumes/ca-lose-wireguard-v15:/etc/wireguard
- /lib/modules:/lib/modules:ro
ports:
- "51830:51830/udp"
# - "51831:51821/tcp" Public Web-UI Port
sysctls:
- net.ipv4.ip_forward=1
- net.ipv4.conf.all.src_valid_mark=1
restart: unless-stopped
depends_on:
- dnsmasq
networks:
ca-lose-internal:
ipv4_address: 172.25.0.6
networks:
ca-lose-internal:
driver: bridge
ipam:
config:
- subnet: 172.25.0.0/24
gateway: 172.25.0.1
+34 -17
View File
@@ -16,8 +16,10 @@
"@mui/joy": "^5.0.0-beta.52",
"@mui/material": "^9.0.1",
"@tailwindcss/vite": "^4.3.0",
"@tanstack/react-query": "^5.100.10",
"i18next": "^26.0.10",
"js-cookie": "^3.0.5",
"k6": "^0.0.0",
"lucide-react": "^1.14.0",
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
@@ -1766,6 +1768,32 @@
"vite": "^5.2.0 || ^6 || ^7 || ^8"
}
},
"node_modules/@tanstack/query-core": {
"version": "5.100.10",
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.100.10.tgz",
"integrity": "sha512-8UR0yJR+GiQ40m3lPhUr0xbfAupe6GSQiksSBSa9SM2NjezFyxXCIA69/lz8cSoNKZLrw1/PktIyQBJcVeMi3w==",
"license": "MIT",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
}
},
"node_modules/@tanstack/react-query": {
"version": "5.100.10",
"resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.100.10.tgz",
"integrity": "sha512-FLaZf2RCrA/Zgp4aiu5tG3TyasTRO7aZ99skxQpr3Hg/zXOhu6yq5FZCYQ/tRaJtM9ylnoK8tFK7PolXQadv6Q==",
"license": "MIT",
"dependencies": {
"@tanstack/query-core": "5.100.10"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"peerDependencies": {
"react": "^18 || ^19"
}
},
"node_modules/@tybys/wasm-util": {
"version": "0.10.2",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz",
@@ -3042,6 +3070,12 @@
"node": ">=6"
}
},
"node_modules/k6": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/k6/-/k6-0.0.0.tgz",
"integrity": "sha512-GAQSWayS2+LjbH5bkRi+pMPYyP1JSp7o+4j58ANZ762N/RH/SdlAT3CHHztnn8s/xgg8kYNM24Gd2IPo9b5W+g==",
"license": "AGPL-3.0"
},
"node_modules/keyv": {
"version": "4.5.4",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
@@ -4178,23 +4212,6 @@
"dev": true,
"license": "ISC"
},
"node_modules/yaml": {
"version": "2.8.4",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.4.tgz",
"integrity": "sha512-ml/JPOj9fOQK8RNnWojA67GbZ0ApXAUlN2UQclwv2eVgTgn7O9gg9o7paZWKMp4g0H3nTLtS9LVzhkpOFIKzog==",
"license": "ISC",
"optional": true,
"peer": true,
"bin": {
"yaml": "bin.mjs"
},
"engines": {
"node": ">= 14.6"
},
"funding": {
"url": "https://github.com/sponsors/eemeli"
}
},
"node_modules/yocto-queue": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
+2
View File
@@ -18,8 +18,10 @@
"@mui/joy": "^5.0.0-beta.52",
"@mui/material": "^9.0.1",
"@tailwindcss/vite": "^4.3.0",
"@tanstack/react-query": "^5.100.10",
"i18next": "^26.0.10",
"js-cookie": "^3.0.5",
"k6": "^0.0.0",
"lucide-react": "^1.14.0",
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
@@ -0,0 +1,31 @@
import { Modal, ModalDialog, Typography, ModalClose } from "@mui/joy";
import { useTranslation } from "react-i18next";
import qrCode from "../../assets/PayPal-QR-Code.png";
interface QRcodeModalProps {
QRmodal: boolean;
setQRmodal: (value: boolean) => void;
}
export const QRcodeModal = (props: QRcodeModalProps) => {
const { t } = useTranslation();
return (
<Modal open={props.QRmodal}>
<ModalDialog color="primary" layout="center" size="lg">
<ModalClose onClick={() => props.setQRmodal(false)} />
<Typography>{t("qr-text")}</Typography>
<img
src={qrCode}
alt="PayPal QR Code"
style={{
width: "100%",
height: "auto",
maxHeight: "70vh",
objectFit: "contain",
}}
/>
</ModalDialog>
</Modal>
);
};
@@ -0,0 +1,40 @@
import {
Modal,
ModalDialog,
Typography,
ModalClose,
Autocomplete,
} from "@mui/joy";
import { useTranslation } from "react-i18next";
interface SelectUserModalProps {
showSelectUser: boolean;
setShowSelectUser: (value: boolean) => void;
usernameData: { users: string[] };
usernameDataIsLoading: boolean;
selectedUser: string | null;
handleUserSelection: (value: string | null) => void;
}
export const SelectUserModal = (props: SelectUserModalProps) => {
const { t } = useTranslation();
return (
<Modal open={props.showSelectUser}>
<ModalDialog color="primary" layout="center" size="lg">
<ModalClose onClick={() => props.setShowSelectUser(false)} />
<Typography>{t("user")}</Typography>
{/* User selection */}
<Autocomplete
options={props.usernameData?.users ?? []}
loading={props.usernameDataIsLoading}
loadingText={t("loading")}
value={props.selectedUser}
onChange={(_, value) => props.handleUserSelection(value)}
placeholder={t("user")}
variant="soft"
sx={{ borderRadius: "10px" }}
/>
</ModalDialog>
</Modal>
);
};
+5
View File
@@ -3,9 +3,14 @@ import { createRoot } from "react-dom/client";
import "./utils/i18n/index.ts";
import "./index.css";
import App from "./App.tsx";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
const queryClient = new QueryClient();
createRoot(document.getElementById("root")!).render(
<StrictMode>
<QueryClientProvider client={queryClient}>
<App />
</QueryClientProvider>
</StrictMode>,
);
+93 -110
View File
@@ -13,19 +13,18 @@ import {
Typography,
FormControl,
FormLabel,
Autocomplete,
ButtonGroup,
Modal,
ModalDialog,
ModalClose,
CircularProgress,
} from "@mui/joy";
import { submitFormData } from "../utils/sender";
import { API_BASE } from "../config/api.config";
import { submitFormData } from "../utils/api/form";
import type { FormData, Message } from "../config/interfaces.config";
import PersonIcon from "@mui/icons-material/Person";
import QrCodeIcon from "@mui/icons-material/QrCode";
import TranslateIcon from "@mui/icons-material/Translate";
import qrCode from "../assets/PayPal-QR-Code.png";
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { confirmUser, fetchUsers } from "../utils/api/users";
import { QRcodeModal } from "../components/modals/QR-CodeModal";
import { SelectUserModal } from "../components/modals/SelectUserModal";
const PAYMENT_METHODS = ["bar", "paypal", "andere"] as const;
const PAYMENT_LABELS: Record<string, string> = {
@@ -82,12 +81,10 @@ const Field = ({
export const MainForm = () => {
const { t, i18n } = useTranslation();
const queryClient = useQueryClient();
const [invoice, setInvoice] = useState(false);
const [msg, setMsg] = useState<Message | null>(null);
const [isLoading, setIsLoading] = useState(false);
const [nextID, setNextID] = useState<number | null>(null);
const [users, setUsers] = useState<string[]>([]);
const [selectedUser, setSelectedUser] = useState<string | null>(null);
const [formData, setFormData] = useState<FormData>(DEFAULT_FORM);
const [showSelectUser, setShowSelectUser] = useState(false);
@@ -97,23 +94,55 @@ export const MainForm = () => {
setFormData({ ...formData, [e.target.name]: e.target.value });
};
const confirmUser = async (username: string) => {
try {
const res = await fetch(
`${API_BASE}/default/confirm-user?username=${username}`,
);
const data = await res.json();
setNextID(data.nextID);
} catch (error) {
console.error("Error confirming user:", error);
useEffect(() => {
const savedUser = Cookies.get("selectedUser");
if (savedUser) {
setSelectedUser(savedUser);
} else {
setMsg({
type: "warning",
headline: t("set-username-headline"),
text: t("set-username-text"),
});
}
};
}, []);
const { data: usernameData, isLoading: usernameDataIsLoading } = useQuery({
queryKey: ["users"],
queryFn: fetchUsers,
});
const { data: userData } = useQuery({
queryKey: ["user", selectedUser],
enabled: !!selectedUser,
queryFn: () => confirmUser(selectedUser),
});
const { mutate: mutateForm, isPending: mutateFormIsPending } = useMutation({
mutationFn: () => submitFormData(formData, selectedUser),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["user", selectedUser] });
document.location.href = `/success?id=${nextID}&tickets=${formData.tickets}`;
},
onError: () => {
queryClient.invalidateQueries({ queryKey: ["user", selectedUser] });
setMsg({
type: "danger",
headline: t("error"),
text: t("form-submission-failed"),
});
},
});
// Setting the nextID after a user is selected
const nextID = userData?.nextID ?? "N/A";
const handleUserSelection = (username: string | null) => {
if (!username) return;
if (username == null || username == "") {
return;
}
setSelectedUser(username);
confirmUser(username);
Cookies.set("selectedUser", username);
};
const changeTranslation = () => {
@@ -134,91 +163,21 @@ export const MainForm = () => {
}
};
useEffect(() => {
if (formData.paymentMethod === "paypal") {
setQRmodal(true);
}
}, [formData.paymentMethod]);
useEffect(() => {
(async () => {
try {
const res = await fetch(`${API_BASE}/default/users`);
const data = await res.json();
setUsers(data.users);
} catch {
setMsg({
type: "danger",
headline: t("error"),
text: t("failed-to-load-users"),
});
}
})();
const cookieUser = Cookies.get("selectedUser");
if (cookieUser) {
setSelectedUser(cookieUser);
confirmUser(cookieUser);
}
}, []);
const handleSubmit = async () => {
setIsLoading(true);
try {
const result = await submitFormData(formData, selectedUser || "");
if (result.success) {
document.location.href = `/success?id=${nextID}&tickets=${formData.tickets}`;
} else {
setMsg({
type: "danger",
headline: t("error"),
text: result.error || t("form-submission-failed"),
});
}
} finally {
setIsLoading(false);
}
};
// Shorthand so we don't repeat formData + onChange on every Field usage
const fieldProps = { formData, onChange: handleChange };
return (
<>
<Modal open={showSelectUser}>
<ModalDialog color="primary" layout="center" size="lg">
<ModalClose onClick={() => setShowSelectUser(false)} />
<Typography>{t("user")}</Typography>
{/* User selection */}
<Autocomplete
options={users}
value={selectedUser}
onChange={(_, value) => handleUserSelection(value)}
placeholder={t("user")}
variant="soft"
sx={{ borderRadius: "10px" }}
onKeyDown={(e) => {
if (e.key === "Enter") e.preventDefault();
}}
<SelectUserModal
showSelectUser={showSelectUser}
setShowSelectUser={setShowSelectUser}
usernameData={usernameData}
usernameDataIsLoading={usernameDataIsLoading}
selectedUser={selectedUser}
handleUserSelection={handleUserSelection}
/>
</ModalDialog>
</Modal>
<Modal open={QRmodal}>
<ModalDialog color="primary" layout="center" size="lg">
<ModalClose onClick={() => setQRmodal(false)} />
<Typography>{t("qr-text")}</Typography>
<img
src={qrCode}
alt="PayPal QR Code"
style={{
width: "100%",
height: "auto",
maxHeight: "70vh",
objectFit: "contain",
}}
/>
</ModalDialog>
</Modal>
<QRcodeModal setQRmodal={setQRmodal} QRmodal={QRmodal} />
<div className="min-h-screen w-full flex items-center justify-center from-slate-100 to-blue-50 p-4">
<Sheet
@@ -250,12 +209,23 @@ export const MainForm = () => {
<IconButton onClick={changeTranslation}>
<TranslateIcon />
</IconButton>
<Typography
level="title-sm"
textColor="var(--joy-palette-success-plainColor)"
sx={{
fontFamily: "monospace",
opacity: "100%",
alignSelf: "center",
}}
>
{`${t("greeting")} ${userData?.fullname ?? t("loading")}`}
</Typography>
</ButtonGroup>
<form
onSubmit={(e) => {
e.preventDefault();
handleSubmit();
mutateForm();
}}
className="flex flex-col gap-4"
>
@@ -372,12 +342,15 @@ export const MainForm = () => {
formData.paymentMethod === method ? "solid" : "soft"
}
color="primary"
onClick={() =>
onClick={() => {
setFormData((prev) => ({
...prev,
paymentMethod: method,
}))
}));
if (method === "paypal") {
setQRmodal(true);
}
}}
sx={{
flex: 1,
minWidth: "90px",
@@ -408,10 +381,13 @@ export const MainForm = () => {
)}
</FormControl>
{/* Submit button */}
{mutateFormIsPending ? (
<div className="flex items-center justify-center">
<CircularProgress />
</div>
) : (
<Button
type="submit"
loading={isLoading}
disabled={!formData.paymentMethod}
size="lg"
sx={{
@@ -427,11 +403,18 @@ export const MainForm = () => {
>
{t("submit")}
</Button>
)}
{/* Alert message */}
{/* Message */}
{msg && (
<Alert color={msg.type} sx={{ borderRadius: "12px" }}>
<strong>{msg.headline}:</strong> {msg.text}
<Alert
color={msg.type}
sx={{ flexDirection: "column", alignItems: "flex-start" }}
>
<Typography level="title-lg" sx={{ mb: 0.5 }}>
{msg.headline}
</Typography>
<Typography level="body-sm">{msg.text}</Typography>
</Alert>
)}
</form>
+29
View File
@@ -0,0 +1,29 @@
import { API_BASE } from "../../config/api.config";
import type { FormData } from "../../config/interfaces.config";
export const submitFormData = async (
data: FormData,
username: string | null,
) => {
console.warn("submitFormData is fetching!");
// await new Promise((resolve) => setTimeout(resolve, 3000)); // Wait 3 seconds
const response = await fetch(
`${API_BASE}/default/new-entry?username=${username}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
},
);
if (!response.ok) {
const error = await response.text();
throw new Error(error || "Form submission failed");
}
return;
};
+25
View File
@@ -0,0 +1,25 @@
import { API_BASE } from "../../config/api.config";
import Cookies from "js-cookie";
export const fetchUsers = async () => {
console.warn("fetchUsers is fetching!");
const response = await fetch(`${API_BASE}/default/users`);
const data = await response.json();
return data;
};
export const confirmUser = async (username: string | null) => {
if (!username) {
return;
}
console.warn("confirmUser is fetching!");
const response = await fetch(
`${API_BASE}/default/confirm-user?username=${username}`,
);
const data = await response.json();
Cookies.set("selectedUser", username);
return data;
};
+6 -2
View File
@@ -14,7 +14,7 @@
"user": "Benutzer",
"next-id": "Nächste Eintragsnummer: ",
"form-submitted-successfully": "Formular erfolgreich übermittelt!",
"orm-submission-failed": "Formularübermittlung fehlgeschlagen.",
"form-submission-failed": "Formularübermittlung fehlgeschlagen.",
"success": "Erfolg",
"error": "Fehler",
"cash": "Bar",
@@ -26,5 +26,9 @@
"thank-you": "Vielen Dank für Ihre Unterstützung der Claudius Akademie! Wir wünschen Ihnen viel Glück mit dem Los.",
"select-payment-method": "Zahlungsmethode auswählen",
"return-to-homepage": "Zurück",
"qr-text": "PayPal QR-Code der Claudius Akademie"
"qr-text": "PayPal QR-Code der Claudius Akademie",
"loading": "Lädt...",
"greeting": "Hallo,",
"set-username-headline": "Keinen Benutzer ausgewählt",
"set-username-text": "Um mit dem Losverkauf zu beginnen, musst du einen Benutzer oben links auswählen."
}
+5 -1
View File
@@ -27,5 +27,9 @@
"thank-you": "Thank you for supporting the Claudius Akademie! We wish you the best of luck with your ticket.",
"select-payment-method": "Select Payment Method",
"return-to-homepage": "Return",
"qr-text": "PayPal QR-Code from the Claudius Akademie"
"qr-text": "PayPal QR-Code from the Claudius Akademie",
"loading": "Loading...",
"greeting": "Hello,",
"set-username-headline": "No user selected",
"set-username-text": "To start the ticket sale, you must select a user first from the top left."
}
-33
View File
@@ -1,33 +0,0 @@
import { API_BASE } from "../config/api.config";
import type { FormData } from "../config/interfaces.config";
export const submitFormData = async (
data: FormData,
username: string | null,
) => {
if (username == null) {
return { success: false, errorCode: "x001" };
}
try {
const response = await fetch(
`${API_BASE}/default/new-entry?username=${username}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
},
);
if (!response.ok) {
const errorText = await response.text();
return { success: false, error: `Server error: ${errorText}` };
}
return { success: true };
} catch (error) {
return { success: false, error: (error as Error).message };
}
};
+13
View File
@@ -0,0 +1,13 @@
import http from "k6/http";
import { sleep } from "k6";
export const options = {
vus: 100, // amount of users
duration: "60s", // duration of the test
};
export default function () {
http.get("http://localhost:8004/default/confirm-user?username=TheisGaedigk");
http.get("http://localhost:8004/default/users");
sleep(1);
}
+15
View File
@@ -0,0 +1,15 @@
// Before running: Establish VPN connection first
import http from "k6/http";
import { sleep } from "k6";
export const options = {
vus: 100, // amount of users
duration: "60s", // duration of the test
};
export default function () {
http.get("http://backend:8004/default/confirm-user?username=TheisGaedigk");
http.get("http://backend:8004/default/users");
sleep(0.5);
}
+1
Submodule wg-easy-ca-lose added at 7b5ba95938