feat: implement user linking for members and update database schema for user associations
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 53s

This commit is contained in:
Torsten Schulz (local)
2026-07-22 23:54:45 +02:00
parent 46079fc16e
commit 3ac4039097
12 changed files with 319 additions and 18 deletions

View File

@@ -123,6 +123,13 @@ const Member = sequelize.define('Member', {
type: DataTypes.INTEGER,
allowNull: false,
},
userId: {
type: DataTypes.INTEGER,
allowNull: true,
unique: true,
field: 'user_id',
comment: 'Linked login account for personal member features',
},
membershipStatus: {
type: DataTypes.STRING,
allowNull: false,

View File

@@ -223,6 +223,9 @@ User.hasMany(UserClub, { foreignKey: 'userId' });
UserClub.belongsTo(Club, { foreignKey: 'clubId', as: 'club' });
Club.hasMany(UserClub, { foreignKey: 'clubId' });
User.hasOne(Member, { foreignKey: 'userId', as: 'memberProfile' });
Member.belongsTo(User, { foreignKey: 'userId', as: 'user' });
Group.belongsTo(DiaryDate, { foreignKey: 'diaryDateId', as: 'diaryDateGroup' });
DiaryDate.hasMany(Group, { foreignKey: 'diaryDateId', as: 'groupsDiaryDate' });