feat(ClubSettings): add country and state code fields for regional calendar data
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 43s
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:
3
backend/migrations/add_calendar_region_to_clubs.sql
Normal file
3
backend/migrations/add_calendar_region_to_clubs.sql
Normal 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;
|
||||
13
backend/migrations/add_range_to_training_cancellations.sql
Normal file
13
backend/migrations/add_range_to_training_cancellations.sql
Normal 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;
|
||||
14
backend/migrations/create_training_cancellations_table.sql
Normal file
14
backend/migrations/create_training_cancellations_table.sql
Normal 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
|
||||
);
|
||||
Reference in New Issue
Block a user