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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user