feat(officialTournament): add auto-registration for tournament participants

- Implemented a new endpoint to automatically register participants for official tournaments using the Click-TT service.
- Added a corresponding method in the frontend to trigger the auto-registration process, enhancing user experience by simplifying participant management.
- Updated the official tournament controller and routes to support the new functionality.
This commit is contained in:
Torsten Schulz (local)
2026-03-11 20:47:44 +01:00
parent 36ed320893
commit 2f82886ad6
4 changed files with 417 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
import { checkAccess } from '../utils/userUtils.js';
import officialTournamentService from '../services/officialTournamentService.js';
import clickTtTournamentRegistrationService from '../services/clickTtTournamentRegistrationService.js';
export const updateOfficialTournament = async (req, res) => {
try {
@@ -116,3 +117,26 @@ export const deleteOfficialTournament = async (req, res) => {
res.status(500).json({ error: 'Failed to delete tournament' });
}
};
export const autoRegisterOfficialTournamentParticipants = async (req, res) => {
try {
const { authcode: userToken } = req.headers;
const { clubId, id: tournamentId } = req.params;
const userId = req.user?.id;
const result = await clickTtTournamentRegistrationService.autoRegisterPendingParticipants({
userToken,
userId,
clubId,
tournamentId
});
res.status(200).json(result);
} catch (e) {
console.error('[autoRegisterOfficialTournamentParticipants] Error:', e);
res.status(e.statusCode || e.status || 500).json({
success: false,
error: e.message || 'Teilnehmer konnten nicht automatisch in click-TT angemeldet werden'
});
}
};