feat(tournaments): add update functionality for official tournaments

- Implemented an API endpoint to update the title of official tournaments, including error handling for non-existent tournaments.
- Enhanced the frontend to allow users to edit tournament titles directly, with input validation and feedback for successful updates or errors.
- Updated the German localization file to include new strings for editing titles and error messages.
This commit is contained in:
Torsten Schulz (local)
2026-03-10 21:54:03 +01:00
parent ea6acd8c6c
commit c13f426b3d
6 changed files with 136 additions and 5 deletions

View File

@@ -1,6 +1,21 @@
import { checkAccess } from '../utils/userUtils.js';
import officialTournamentService from '../services/officialTournamentService.js';
export const updateOfficialTournament = async (req, res) => {
try {
const { authcode: userToken } = req.headers;
const { clubId, id } = req.params;
await checkAccess(userToken, clubId);
const result = await officialTournamentService.updateOfficialTournament(clubId, id, req.body);
if (!result) return res.status(404).json({ error: 'not found' });
res.status(200).json(result);
} catch (e) {
console.error('[updateOfficialTournament] Error:', e);
res.status(500).json({ error: 'Failed to update tournament' });
}
};
export const uploadTournamentPdf = async (req, res) => {
try {
const { authcode: userToken } = req.headers;