feat(matches): add optional match credentials fields to manual match creation and update localization
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 56s

This commit is contained in:
Torsten Schulz (local)
2026-08-20 08:57:24 +02:00
parent eb1c4d5842
commit 38c665d30d
6 changed files with 22 additions and 3 deletions

View File

@@ -52,6 +52,7 @@ class MatchService {
const opponentName = String(payload.opponentName || '').trim();
const homeAway = payload.homeAway === 'away' ? 'away' : 'home';
const fixtureType = String(payload.fixtureType || 'league').trim();
const optionalCredential = (value) => String(value || '').trim().slice(0, 255) || null;
if (!['league', 'cup'].includes(fixtureType)) {
throw new HttpError('Ungültiger Spieltyp', 400);
}
@@ -82,7 +83,11 @@ class MatchService {
date: new Date(`${date}T${time}:00`), time, clubId: parsedClubId, leagueId: league.id, locationId,
homeTeamId: homeAway === 'home' ? ownTeam.id : opponentTeam.id,
guestTeamId: homeAway === 'home' ? opponentTeam.id : ownTeam.id,
fixtureType, notes: String(payload.notes || '').trim() || null
fixtureType,
code: optionalCredential(payload.code),
homePin: optionalCredential(payload.homePin),
guestPin: optionalCredential(payload.guestPin),
notes: String(payload.notes || '').trim() || null
});
return { id: match.id, clubId: match.clubId, match: await this.enrichMatch(match) };
}