diff --git a/backend/services/clickTtPlayerRegistrationService.js b/backend/services/clickTtPlayerRegistrationService.js index 84e69f86..f4d00dbc 100644 --- a/backend/services/clickTtPlayerRegistrationService.js +++ b/backend/services/clickTtPlayerRegistrationService.js @@ -47,10 +47,21 @@ class ClickTtPlayerRegistrationService { throw new HttpError('Mitglied nicht gefunden', 404); } - const club = await Club.findByPk(clubId); - const associationMemberNumber = String(club?.associationMemberNumber || '').trim(); + const club = await Club.findByPk(clubId, { + attributes: ['id', 'name', 'associationMemberNumber'], + }); + const associationMemberNumber = String( + club?.associationMemberNumber ?? + club?.association_member_number ?? + club?.dataValues?.associationMemberNumber ?? + club?.dataValues?.association_member_number ?? + '' + ).trim(); if (!associationMemberNumber) { - throw new HttpError('Für den Verein ist keine Verbands-Mitgliedsnummer hinterlegt', 400); + throw new HttpError( + `Für den Verein "${club?.name ?? clubId}" ist keine Verbands-Mitgliedsnummer hinterlegt. Bitte in den Vereinseinstellungen unter "Verbands-Mitgliedsnummer" eintragen.`, + 400 + ); } const account = await ClickTtAccount.findOne({ where: { userId } });