feat(ClubSettings): add country and state code fields for regional calendar data
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 43s

- Introduced `countryCode` and `stateCode` fields in the Club model to support regional calendar data.
- Updated ClubSettings component to allow users to select their country and state, enhancing the configuration options for clubs.
- Enhanced the ClubService to handle normalization of country and state codes during updates.
- Added new routes and middleware to support the training cancellation feature and calendar integration in the backend.
- Updated frontend navigation to include a calendar link, improving user access to scheduling features.
This commit is contained in:
Torsten Schulz (local)
2026-05-12 23:46:07 +02:00
parent 1e23171370
commit bea5facb7d
46 changed files with 4286 additions and 12 deletions

View File

@@ -0,0 +1,3 @@
ALTER TABLE clubs
ADD COLUMN IF NOT EXISTS country_code VARCHAR(2) NOT NULL DEFAULT 'DE',
ADD COLUMN IF NOT EXISTS state_code VARCHAR(16) NULL;

View File

@@ -0,0 +1,13 @@
ALTER TABLE training_cancellations
ADD COLUMN IF NOT EXISTS start_date DATE NULL,
ADD COLUMN IF NOT EXISTS end_date DATE NULL;
UPDATE training_cancellations
SET
start_date = COALESCE(start_date, date),
end_date = COALESCE(end_date, date)
WHERE start_date IS NULL OR end_date IS NULL;
ALTER TABLE training_cancellations
MODIFY start_date DATE NOT NULL,
MODIFY end_date DATE NOT NULL;

View File

@@ -0,0 +1,14 @@
CREATE TABLE IF NOT EXISTS training_cancellations (
id INT AUTO_INCREMENT PRIMARY KEY,
club_id INT NOT NULL,
start_date DATE NOT NULL,
end_date DATE NOT NULL,
date DATE NULL,
reason VARCHAR(255) NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY uniq_training_cancellation_club_range (club_id, start_date, end_date),
CONSTRAINT fk_training_cancellations_club
FOREIGN KEY (club_id) REFERENCES clubs(id)
ON DELETE CASCADE
);