feat(tournament-suggestions): implement save functionality for tournament suggestions
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 8m44s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 8m44s
This commit is contained in:
@@ -2,6 +2,20 @@ import { checkAccess } from '../utils/userUtils.js';
|
||||
import officialTournamentService from '../services/officialTournamentService.js';
|
||||
import clickTtTournamentRegistrationService from '../services/clickTtTournamentRegistrationService.js';
|
||||
|
||||
export const saveTournamentSuggestion = async (req, res) => {
|
||||
try {
|
||||
const { authcode: userToken } = req.headers;
|
||||
const { clubId, id } = req.params;
|
||||
await checkAccess(userToken, clubId);
|
||||
const result = await officialTournamentService.saveTournamentSuggestion(clubId, id);
|
||||
if (!result) return res.status(404).json({ error: 'Turniervorschlag nicht gefunden.' });
|
||||
return res.status(result.created ? 201 : 200).json(result);
|
||||
} catch (error) {
|
||||
console.error('[saveTournamentSuggestion] Error:', error);
|
||||
return res.status(error.status || 500).json({ error: error.message || 'Turniervorschlag konnte nicht gespeichert werden.' });
|
||||
}
|
||||
};
|
||||
|
||||
export const updateOfficialTournament = async (req, res) => {
|
||||
try {
|
||||
const { authcode: userToken } = req.headers;
|
||||
|
||||
Reference in New Issue
Block a user