Enhance member management by adding postal code and contact handling

Introduced a postal code field to the member model and implemented a new MemberContact model to manage multiple phone numbers and email addresses. Updated the member service and controller to handle contact data during member creation and updates. Enhanced the MembersView component to support input for multiple contacts, ensuring better organization and accessibility of member information.
This commit is contained in:
Torsten Schulz (local)
2025-11-06 16:12:34 +01:00
parent 5a4553a8a0
commit 9cdbd60a23
8 changed files with 417 additions and 23 deletions

View File

@@ -52,6 +52,7 @@ const Member = sequelize.define('Member', {
},
get() {
const encryptedValue = this.getDataValue('birthDate');
if (!encryptedValue) return null;
return decryptData(encryptedValue);
}
},
@@ -91,6 +92,21 @@ const Member = sequelize.define('Member', {
return decryptData(encryptedValue);
}
},
postalCode: {
type: DataTypes.STRING,
allowNull: true,
set(value) {
const encryptedValue = encryptData(value || '');
this.setDataValue('postalCode', encryptedValue);
},
get() {
const encryptedValue = this.getDataValue('postalCode');
if (!encryptedValue) return null;
return decryptData(encryptedValue);
},
field: 'postal_code',
comment: 'Postal code (PLZ)'
},
email: {
type: DataTypes.STRING,
allowNull: false,

View File

@@ -40,6 +40,7 @@ import MyTischtennisUpdateHistory from './MyTischtennisUpdateHistory.js';
import MyTischtennisFetchLog from './MyTischtennisFetchLog.js';
import ApiLog from './ApiLog.js';
import MemberTransferConfig from './MemberTransferConfig.js';
import MemberContact from './MemberContact.js';
// Official tournaments relations
OfficialTournament.hasMany(OfficialCompetition, { foreignKey: 'tournamentId', as: 'competitions' });
OfficialCompetition.belongsTo(OfficialTournament, { foreignKey: 'tournamentId', as: 'tournament' });
@@ -246,6 +247,9 @@ ApiLog.belongsTo(User, { foreignKey: 'userId', as: 'user' });
Club.hasOne(MemberTransferConfig, { foreignKey: 'clubId', as: 'memberTransferConfig' });
MemberTransferConfig.belongsTo(Club, { foreignKey: 'clubId', as: 'club' });
Member.hasMany(MemberContact, { foreignKey: 'memberId', as: 'contacts' });
MemberContact.belongsTo(Member, { foreignKey: 'memberId', as: 'member' });
export {
User,
Log,
@@ -288,4 +292,5 @@ export {
MyTischtennisFetchLog,
ApiLog,
MemberTransferConfig,
MemberContact,
};