feat(ClubTeam): add planned league name field and localization updates
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 34s
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user