feat(matches): add fixture type handling and notes to manual match creation; update localization for match types
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 56s

This commit is contained in:
Torsten Schulz (local)
2026-08-20 08:39:52 +02:00
parent 18ba120927
commit eb1c4d5842
7 changed files with 140 additions and 11 deletions

View File

@@ -51,6 +51,10 @@ class MatchService {
const time = String(payload.time || '').trim();
const opponentName = String(payload.opponentName || '').trim();
const homeAway = payload.homeAway === 'away' ? 'away' : 'home';
const fixtureType = String(payload.fixtureType || 'league').trim();
if (!['league', 'cup'].includes(fixtureType)) {
throw new HttpError('Ungültiger Spieltyp', 400);
}
if (!Number.isInteger(clubTeamId) || !/^\d{4}-\d{2}-\d{2}$/.test(date) || !/^\d{2}:\d{2}$/.test(time) || !opponentName) {
throw new HttpError('Mannschaft, Gegner, Datum und Uhrzeit sind erforderlich', 400);
}
@@ -78,7 +82,7 @@ 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: 'cup', notes: String(payload.notes || '').trim() || null
fixtureType, notes: String(payload.notes || '').trim() || null
});
return { id: match.id, clubId: match.clubId, match: await this.enrichMatch(match) };
}