Erweitert die Backend- und Frontend-Funktionalität zur Unterstützung von Teams und Saisons. Fügt neue Routen für Team- und Club-Team-Management hinzu, aktualisiert die Match- und Team-Modelle zur Berücksichtigung von Saisons, und implementiert die Saison-Auswahl in der Benutzeroberfläche. Optimiert die Logik zur Abfrage von Ligen und Spielen basierend auf der ausgewählten Saison.
This commit is contained in:
32
backend/routes/clubTeamRoutes.js
Normal file
32
backend/routes/clubTeamRoutes.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import express from 'express';
|
||||
import { authenticate } from '../middleware/authMiddleware.js';
|
||||
import {
|
||||
getClubTeams,
|
||||
getClubTeam,
|
||||
createClubTeam,
|
||||
updateClubTeam,
|
||||
deleteClubTeam,
|
||||
getLeagues
|
||||
} from '../controllers/clubTeamController.js';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
// Get all club teams for a club
|
||||
router.get('/club/:clubid', authenticate, getClubTeams);
|
||||
|
||||
// Create a new club team
|
||||
router.post('/club/:clubid', authenticate, createClubTeam);
|
||||
|
||||
// Get leagues for a club
|
||||
router.get('/leagues/:clubid', authenticate, getLeagues);
|
||||
|
||||
// Get a specific club team
|
||||
router.get('/:clubteamid', authenticate, getClubTeam);
|
||||
|
||||
// Update a club team
|
||||
router.put('/:clubteamid', authenticate, updateClubTeam);
|
||||
|
||||
// Delete a club team
|
||||
router.delete('/:clubteamid', authenticate, deleteClubTeam);
|
||||
|
||||
export default router;
|
||||
28
backend/routes/seasonRoutes.js
Normal file
28
backend/routes/seasonRoutes.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import express from 'express';
|
||||
import { authenticate } from '../middleware/authMiddleware.js';
|
||||
import {
|
||||
getSeasons,
|
||||
getCurrentSeason,
|
||||
createSeason,
|
||||
getSeason,
|
||||
deleteSeason
|
||||
} from '../controllers/seasonController.js';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
// Get all seasons
|
||||
router.get('/', authenticate, getSeasons);
|
||||
|
||||
// Get current season (creates if not exists)
|
||||
router.get('/current', authenticate, getCurrentSeason);
|
||||
|
||||
// Get a specific season
|
||||
router.get('/:seasonid', authenticate, getSeason);
|
||||
|
||||
// Create a new season
|
||||
router.post('/', authenticate, createSeason);
|
||||
|
||||
// Delete a season
|
||||
router.delete('/:seasonid', authenticate, deleteSeason);
|
||||
|
||||
export default router;
|
||||
32
backend/routes/teamRoutes.js
Normal file
32
backend/routes/teamRoutes.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import express from 'express';
|
||||
import { authenticate } from '../middleware/authMiddleware.js';
|
||||
import {
|
||||
getTeams,
|
||||
getTeam,
|
||||
createTeam,
|
||||
updateTeam,
|
||||
deleteTeam,
|
||||
getLeagues
|
||||
} from '../controllers/teamController.js';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
// Get all teams for a club
|
||||
router.get('/club/:clubid', authenticate, getTeams);
|
||||
|
||||
// Get leagues for a club
|
||||
router.get('/leagues/:clubid', authenticate, getLeagues);
|
||||
|
||||
// Get a specific team
|
||||
router.get('/:teamid', authenticate, getTeam);
|
||||
|
||||
// Create a new team
|
||||
router.post('/club/:clubid', authenticate, createTeam);
|
||||
|
||||
// Update a team
|
||||
router.put('/:teamid', authenticate, updateTeam);
|
||||
|
||||
// Delete a team
|
||||
router.delete('/:teamid', authenticate, deleteTeam);
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user