First steps for tournament
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user