feat(tournament): enhance external participant management with email and address fields
- Added email and address fields to the external participant model, allowing for more comprehensive participant information. - Updated the tournament service and controller to handle the new fields when adding external participants. - Modified frontend components to include input fields for email and address, improving user experience and data collection. - Updated localization strings to support the new fields, ensuring clarity in the user interface.
This commit is contained in:
@@ -545,9 +545,9 @@ export const setMatchActive = async (req, res) => {
|
||||
// Externe Teilnehmer hinzufügen
|
||||
export const addExternalParticipant = async (req, res) => {
|
||||
const { authcode: token } = req.headers;
|
||||
const { clubId, tournamentId, classId, firstName, lastName, club, birthDate, gender } = req.body;
|
||||
const { clubId, tournamentId, classId, firstName, lastName, club, birthDate, gender, email, address } = req.body;
|
||||
try {
|
||||
await tournamentService.addExternalParticipant(token, clubId, classId, firstName, lastName, club, birthDate, gender);
|
||||
await tournamentService.addExternalParticipant(token, clubId, classId, firstName, lastName, club, birthDate, gender, email, address);
|
||||
emitTournamentChanged(clubId, tournamentId);
|
||||
res.status(200).json({ message: 'Externer Teilnehmer hinzugefügt' });
|
||||
} catch (error) {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
-- E-Mail und Adresse für externe Teilnehmer (für Weitermeldung)
|
||||
-- Die Felder werden verschlüsselt gespeichert (siehe Model)
|
||||
|
||||
ALTER TABLE `external_tournament_participant`
|
||||
ADD COLUMN `email` VARCHAR(500) NULL AFTER `club`,
|
||||
ADD COLUMN `address` TEXT NULL AFTER `email`;
|
||||
@@ -53,6 +53,40 @@ const ExternalTournamentParticipant = sequelize.define('ExternalTournamentPartic
|
||||
return decryptData(encryptedValue);
|
||||
}
|
||||
},
|
||||
email: {
|
||||
type: DataTypes.STRING(500),
|
||||
allowNull: true,
|
||||
set(value) {
|
||||
if (!value) {
|
||||
this.setDataValue('email', null);
|
||||
return;
|
||||
}
|
||||
const encryptedValue = encryptData(value);
|
||||
this.setDataValue('email', encryptedValue);
|
||||
},
|
||||
get() {
|
||||
const encryptedValue = this.getDataValue('email');
|
||||
if (!encryptedValue) return null;
|
||||
return decryptData(encryptedValue);
|
||||
}
|
||||
},
|
||||
address: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true,
|
||||
set(value) {
|
||||
if (!value) {
|
||||
this.setDataValue('address', null);
|
||||
return;
|
||||
}
|
||||
const encryptedValue = encryptData(value);
|
||||
this.setDataValue('address', encryptedValue);
|
||||
},
|
||||
get() {
|
||||
const encryptedValue = this.getDataValue('address');
|
||||
if (!encryptedValue) return null;
|
||||
return decryptData(encryptedValue);
|
||||
}
|
||||
},
|
||||
birthDate: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
|
||||
@@ -3369,7 +3369,7 @@ Ve // 2. Neues Turnier anlegen
|
||||
}
|
||||
|
||||
// Externe Teilnehmer hinzufügen
|
||||
async addExternalParticipant(userToken, clubId, classId, firstName, lastName, club, birthDate, gender) {
|
||||
async addExternalParticipant(userToken, clubId, classId, firstName, lastName, club, birthDate, gender, email = null, address = null) {
|
||||
await checkAccess(userToken, clubId);
|
||||
if (!classId) {
|
||||
throw new Error('Klasse ist erforderlich');
|
||||
@@ -3432,6 +3432,8 @@ Ve // 2. Neues Turnier anlegen
|
||||
firstName,
|
||||
lastName,
|
||||
club: club || null,
|
||||
email: email || null,
|
||||
address: address || null,
|
||||
birthDate: birthDate || null,
|
||||
gender: participantGender,
|
||||
groupId: null
|
||||
|
||||
Reference in New Issue
Block a user