feat(ClubTeam): add planned league name field and localization updates
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 34s

- Introduced a new field for planned league name in the ClubTeam model, allowing for better team categorization.
- Updated create and update club team endpoints to handle the new planned league name field.
- Enhanced the PDF generation feature to include planned league name in the output.
- Improved localization files across multiple languages to incorporate new terms related to the planned league, ensuring a consistent user experience.
- Updated the TeamManagementView to display and edit the planned league name, enhancing user interaction.
This commit is contained in:
Torsten Schulz (local)
2026-04-02 08:17:13 +02:00
parent 9454761e34
commit 68b8455340
21 changed files with 143 additions and 22 deletions

View File

@@ -42,7 +42,7 @@ export const createClubTeam = async (req, res) => {
try {
const { authcode: token } = req.headers;
const { clubid: clubId } = req.params;
const { name, leagueId, seasonId, teamGender, teamAgeGroup } = req.body;
const { name, leagueId, seasonId, teamGender, teamAgeGroup, plannedLeagueName } = req.body;
const user = await getUserByToken(token);
@@ -50,13 +50,17 @@ export const createClubTeam = async (req, res) => {
return res.status(400).json({ error: "missingname" });
}
const planned = plannedLeagueName !== undefined && plannedLeagueName !== null
? String(plannedLeagueName).trim() || null
: undefined;
const clubTeamData = {
name,
clubId: parseInt(clubId),
leagueId: leagueId ? parseInt(leagueId) : null,
seasonId: seasonId ? parseInt(seasonId) : null,
teamGender: teamGender || 'open',
teamAgeGroup: teamAgeGroup || 'adult'
teamAgeGroup: teamAgeGroup || 'adult',
...(planned !== undefined ? { plannedLeagueName: planned } : {})
};
const newClubTeam = await ClubTeamService.createClubTeam(clubTeamData);
@@ -72,7 +76,7 @@ export const updateClubTeam = async (req, res) => {
try {
const { authcode: token } = req.headers;
const { clubteamid: clubTeamId } = req.params;
const { name, leagueId, seasonId, teamGender, teamAgeGroup } = req.body;
const { name, leagueId, seasonId, teamGender, teamAgeGroup, plannedLeagueName } = req.body;
const user = await getUserByToken(token);
@@ -82,6 +86,11 @@ export const updateClubTeam = async (req, res) => {
if (seasonId !== undefined) updateData.seasonId = seasonId ? parseInt(seasonId) : null;
if (teamGender !== undefined) updateData.teamGender = teamGender || 'open';
if (teamAgeGroup !== undefined) updateData.teamAgeGroup = teamAgeGroup || 'adult';
if (plannedLeagueName !== undefined) {
updateData.plannedLeagueName = plannedLeagueName === null || plannedLeagueName === ''
? null
: String(plannedLeagueName).trim() || null;
}
const success = await ClubTeamService.updateClubTeam(clubTeamId, updateData);
if (!success) {

View File

@@ -0,0 +1,6 @@
-- Optional: manuell gepflegte geplante Spielklasse (unabhängig von league / MyTischtennis)
ALTER TABLE `club_team`
ADD COLUMN `planned_league_name` VARCHAR(512) NULL
COMMENT 'Geplante Spielklasse (freier Text, optional)'
AFTER `team_age_group`;

View File

@@ -63,6 +63,12 @@ const ClubTeam = sequelize.define('ClubTeam', {
defaultValue: 'adult',
field: 'team_age_group'
},
plannedLeagueName: {
type: DataTypes.STRING(512),
allowNull: true,
field: 'planned_league_name',
comment: 'Geplante Spielklasse (manuell, optional)'
},
}, {
underscored: true,
tableName: 'club_team',

View File

@@ -44,6 +44,7 @@ class ClubTeamService {
myTischtennisTeamId: clubTeam.myTischtennisTeamId,
teamGender: clubTeam.teamGender,
teamAgeGroup: clubTeam.teamAgeGroup,
plannedLeagueName: clubTeam.plannedLeagueName,
createdAt: clubTeam.createdAt,
updatedAt: clubTeam.updatedAt,
league: { name: 'Unbekannt' },