refactor(clubSettings): remove myTischtennis club ID and update related logic
- Removed the myTischtennis club ID field from club settings and related backend logic. - Updated the database migration to eliminate the my_tischtennis_club_id column. - Adjusted frontend components and services to reflect the removal of the club ID, ensuring the use of association member number instead. - Enhanced user interface hints to clarify the use of association member number for rankings.
This commit is contained in:
@@ -60,11 +60,10 @@ export const updateClubSettings = async (req, res) => {
|
||||
try {
|
||||
const { authcode: token } = req.headers;
|
||||
const { clubid } = req.params;
|
||||
const { greetingText, associationMemberNumber, myTischtennisClubId, myTischtennisFedNickname, autoFetchRankings } = req.body;
|
||||
const { greetingText, associationMemberNumber, myTischtennisFedNickname, autoFetchRankings } = req.body;
|
||||
const updated = await ClubService.updateClubSettings(token, clubid, {
|
||||
greetingText,
|
||||
associationMemberNumber,
|
||||
myTischtennisClubId,
|
||||
myTischtennisFedNickname,
|
||||
autoFetchRankings
|
||||
});
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
-- Migration: Add myTischtennis rankings settings to clubs table
|
||||
-- Enables per-club configuration of TTR/QTTR rankings fetch (club ID, federation, enable flag)
|
||||
-- Enables per-club configuration of TTR/QTTR rankings fetch.
|
||||
-- Club number comes from association_member_number (Verbands-Mitgliedsnummer).
|
||||
|
||||
ALTER TABLE clubs
|
||||
ADD COLUMN IF NOT EXISTS my_tischtennis_club_id VARCHAR(50) NULL
|
||||
COMMENT 'myTischtennis club number for rankings (e.g. 43030)',
|
||||
ADD COLUMN IF NOT EXISTS my_tischtennis_fed_nickname VARCHAR(50) NULL
|
||||
COMMENT 'Federation short name for rankings (e.g. HeTTV)',
|
||||
ADD COLUMN IF NOT EXISTS auto_fetch_rankings BOOLEAN NOT NULL DEFAULT FALSE
|
||||
|
||||
@@ -17,12 +17,6 @@ const Club = sequelize.define('Club', {
|
||||
allowNull: true,
|
||||
field: 'association_member_number'
|
||||
},
|
||||
myTischtennisClubId: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
field: 'my_tischtennis_club_id',
|
||||
comment: 'myTischtennis club number for rankings (e.g. 43030)'
|
||||
},
|
||||
myTischtennisFedNickname: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
|
||||
@@ -70,7 +70,6 @@ class ClubService {
|
||||
async updateClubSettings(userToken, clubId, {
|
||||
greetingText,
|
||||
associationMemberNumber,
|
||||
myTischtennisClubId,
|
||||
myTischtennisFedNickname,
|
||||
autoFetchRankings
|
||||
}) {
|
||||
@@ -80,7 +79,6 @@ class ClubService {
|
||||
throw new Error('clubnotfound');
|
||||
}
|
||||
const updates = { greetingText, associationMemberNumber };
|
||||
if (myTischtennisClubId !== undefined) updates.myTischtennisClubId = myTischtennisClubId || null;
|
||||
if (myTischtennisFedNickname !== undefined) updates.myTischtennisFedNickname = myTischtennisFedNickname || null;
|
||||
if (autoFetchRankings !== undefined) updates.autoFetchRankings = !!autoFetchRankings;
|
||||
return await club.update(updates);
|
||||
|
||||
@@ -396,14 +396,14 @@ class MemberService {
|
||||
};
|
||||
}
|
||||
|
||||
const effectiveClubId = (club.myTischtennisClubId || '').trim() || account.clubId;
|
||||
const effectiveClubId = (club.associationMemberNumber || '').trim() || account.clubId;
|
||||
const effectiveFedNickname = (club.myTischtennisFedNickname || '').trim() || account.fedNickname;
|
||||
|
||||
if (!effectiveClubId || !effectiveFedNickname) {
|
||||
console.error('[updateRatingsFromMyTischtennis] - Missing clubId or fedNickname:', {
|
||||
clubId: effectiveClubId,
|
||||
fedNickname: effectiveFedNickname,
|
||||
fromClub: !!(club.myTischtennisClubId && club.myTischtennisFedNickname)
|
||||
fromClub: !!(club.associationMemberNumber && club.myTischtennisFedNickname)
|
||||
});
|
||||
return {
|
||||
status: 400,
|
||||
|
||||
Reference in New Issue
Block a user