First steps for tournament

This commit is contained in:
Torsten Schulz
2025-03-13 16:19:07 +01:00
parent df41720b50
commit 821f9d24f5
5 changed files with 111 additions and 16 deletions

View File

@@ -121,13 +121,26 @@ export const getTournamentMatches = async (req, res) => {
export const addMatchResult = async (req, res) => {
const { authcode: token } = req.headers;
const { clubId, tournamentId, matchId, result } = req.body;
const { clubId, tournamentId, matchId, set, result } = req.body;
try {
await tournamentService.addMatchResult(token, clubId, tournamentId, matchId, result);
await tournamentService.addMatchResult(token, clubId, tournamentId, matchId, set, result);
res.status(200).json({ message: "Result added successfully" });
} catch (error) {
console.error(error);
res.status(500).json({ error: error.message });
}
};
export const finishMatch = async (req, res) => {
const { authcode: token } = req.headers;
const { clubId, tournamentId, matchId } = req.body;
try {
await tournamentService.finishMatch(token, clubId, tournamentId, matchId);
res.status(200).json({ message: "Match finished successfully" });
} catch (error) {
console.error(error);
res.status(500).json({ error: error.message });
}
}