Update training group management and enhance UI components
This commit introduces the `TrainingGroup` model and related functionality, allowing for the management of training groups within the application. The `ClubService` is updated to automatically create preset groups upon club creation. The frontend is enhanced with new views and components, including `TrainingGroupsView` and `TrainingGroupsTab`, to facilitate the display and management of training groups. Additionally, the `MembersView` is updated to allow adding and removing members from training groups, improving the overall user experience and interactivity in managing club members and their associated training groups.
This commit is contained in:
17
backend/migrations/create_club_disabled_preset_groups.sql
Normal file
17
backend/migrations/create_club_disabled_preset_groups.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
-- Migration: Create club_disabled_preset_groups table
|
||||
-- Date: 2025-01-16
|
||||
-- For MariaDB/MySQL
|
||||
-- Stores which preset groups are disabled for each club
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `club_disabled_preset_groups` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`club_id` INT(11) NOT NULL,
|
||||
`preset_type` ENUM('anfaenger', 'fortgeschrittene', 'erwachsene', 'nachwuchs', 'leistungsgruppe') NOT NULL,
|
||||
`created_at` DATETIME NOT NULL,
|
||||
`updated_at` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `unique_club_preset_type` (`club_id`, `preset_type`),
|
||||
KEY `club_id` (`club_id`),
|
||||
CONSTRAINT `club_disabled_preset_groups_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
34
backend/migrations/create_training_group_tables.sql
Normal file
34
backend/migrations/create_training_group_tables.sql
Normal file
@@ -0,0 +1,34 @@
|
||||
-- Migration: Create training_group and member_training_group tables
|
||||
-- Date: 2025-01-16
|
||||
-- For MariaDB/MySQL
|
||||
|
||||
-- Create training_group table
|
||||
CREATE TABLE IF NOT EXISTS `training_group` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`club_id` INT(11) NOT NULL,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`is_preset` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`preset_type` ENUM('anfaenger', 'fortgeschrittene', 'erwachsene', 'nachwuchs', 'leistungsgruppe') NULL,
|
||||
`sort_order` INT(11) NOT NULL DEFAULT 0,
|
||||
`created_at` DATETIME NOT NULL,
|
||||
`updated_at` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `club_id` (`club_id`),
|
||||
CONSTRAINT `training_group_ibfk_1` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- Create member_training_group junction table
|
||||
CREATE TABLE IF NOT EXISTS `member_training_group` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`member_id` INT(11) NOT NULL,
|
||||
`training_group_id` INT(11) NOT NULL,
|
||||
`created_at` DATETIME NOT NULL,
|
||||
`updated_at` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `unique_member_group` (`member_id`, `training_group_id`),
|
||||
KEY `member_id` (`member_id`),
|
||||
KEY `training_group_id` (`training_group_id`),
|
||||
CONSTRAINT `member_training_group_ibfk_1` FOREIGN KEY (`member_id`) REFERENCES `member` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `member_training_group_ibfk_2` FOREIGN KEY (`training_group_id`) REFERENCES `training_group` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
Reference in New Issue
Block a user